#6 Water And Ship

This commit is contained in:
M1_IDMhan 2023-08-02 14:36:11 +09:00
parent 222ad73761
commit 5c2d84e613
16 changed files with 644 additions and 282480 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0c3f92a3fa26b4b5e93b66ed7f2e75a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b6a64ba0b99cb4a9ba4f6236076fc5b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f15e6518f147e4bba903ada4a9fa0eb3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Floater : MonoBehaviour
{
public Rigidbody rigidBody;
public float depthBeforeSubmerged = 1f;
public float displacementAmount = 3f;
public int floaterCount = 1;
public float waterDrag = 0.99f;
public float waterAngularDrag = 0.5f;
private void FixedUpdate()
{
rigidBody.AddForceAtPosition(Physics.gravity / floaterCount, transform.position, ForceMode.Acceleration);
float waveHeight = WaveManager.Instance.GetWaveHeight(transform.position.x);
if (transform.position.y < waveHeight)
{
float displacementMultiplier = Mathf.Clamp01((waveHeight - transform.position.y) / depthBeforeSubmerged) * displacementAmount;
rigidBody.AddForceAtPosition(new Vector3(0f, Mathf.Abs(Physics.gravity.y) * displacementMultiplier, 0f), transform.position, ForceMode.Acceleration);
rigidBody.AddForce(displacementMultiplier * -rigidBody.velocity * waterDrag * Time.fixedDeltaTime, ForceMode.VelocityChange);
rigidBody.AddTorque(displacementMultiplier * -rigidBody.angularVelocity * waterAngularDrag * Time.fixedDeltaTime, ForceMode.VelocityChange);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ca68bc2df97bc4c43a817e4a07ea1814
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class WaterManager : MonoBehaviour
{
private MeshFilter meshFilter;
private void Awake()
{
meshFilter = GetComponent<MeshFilter>();
}
private void Update()
{
Vector3[] vertices = meshFilter.mesh.vertices;
for (int i = 0; i < vertices.Length; i++)
{
vertices[i].y = WaveManager.Instance.GetWaveHeight(transform.position.x + vertices[i].x);
}
meshFilter.mesh.vertices = vertices;
meshFilter.mesh.RecalculateNormals();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 58d3123bba1e4be4813c40e9f26a7702
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,35 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WaveManager : MonoBehaviour
{
public static WaveManager Instance { get; private set; }
public float amplitude = 1f;
public float length = 2f;
public float speed = 1f;
public float offset = 0f;
private void Awake()
{
if (Instance == null)
Instance = this;
else if (Instance != this)
{
Debug.LogWarning("인스턴스가 이미 존재합니다. 새로 생성된 인스턴스를 삭제합니다.");
Destroy(this);
}
}
private void Update()
{
offset += Time.deltaTime * speed;
}
public float GetWaveHeight(float x)
{
return amplitude * Mathf.Sin(x / length + offset);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e030824537d64505a8560a4d8d344587
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a70a37684bd7a42428cdf4e9e239bca9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,285 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: '[Custom] StylizedWater2_Mobile'
m_Shader: {fileID: -6465566751694194690, guid: d7b0192b9bf19c949900035fa781fdc4,
type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ENVIRONMENTREFLECTIONS_OFF
- _FOAM
- _NORMALMAP
- _RECEIVE_SHADOWS_OFF
- _SHARP_INERSECTION
- _UNLIT
- _WAVES
m_InvalidKeywords:
- ADVANCED_LIGHTING
- _CROSSPAN_INTERSECTION
- _DEPTHEXP_ON
- _DEPTH_TEX
- _SIMPLE_LIGHTING
- _WORLDSPACEUV_ON
- _ZCLIP_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 2800000, guid: ec6f0adef15b52448a82f3f183525d84, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMapLarge:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMapSlope:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CausticsTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DepthTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FoamTex:
m_Texture: {fileID: 2800000, guid: 2e10c404ec8e1ff41bff06b82e5569df, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IntersectionNoise:
m_Texture: {fileID: 2800000, guid: b8850342fb8b1e846ac3807e35ec1685, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Normals:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _PlanarReflection:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _PlanarReflectionLeft:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Shadermap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- Vector1_1942CF3A: 1
- Vector1_BE75C478: 32
- Vector1_E23F9E57: 0.5
- Vector1_E796673B: 10
- _ADVANCED_LIGHTING: 1
- _AdvancedLighting: 1
- _Advanced_Lighting: 1
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AnimationSpeed: 1
- _Blend: 0
- _BumpScale: 1
- _CROSSPAN_INTERSECTIONOn: 1
- _CausticsBrightness: 4.83
- _CausticsDistortion: 0.15
- _CausticsOn: 0
- _CausticsSpeed: 0.1
- _CausticsTiling: 0.5
- _CrossPan_IntersectionOn: 0
- _Cull: 2
- _Cutoff: 0.5
- _Depth: 5.01
- _DepthExp: 1
- _DepthHorizontal: 1
- _DepthMode: 0
- _DepthTexture: 1
- _DepthVertical: 4
- _DisableDepthTexture: 0
- _DistanceNormalsOn: 0
- _DistanceNormalsTiling: 0.25
- _DstBlend: 0
- _EdgeFade: 7.37
- _EnvironmentReflections: 1
- _EnvironmentReflectionsOn: 0
- _FlatShadingOn: 0
- _FlowSpeed: 1
- _FoamOn: 1
- _FoamOpacity: 0.253
- _FoamSize: 0.01
- _FoamSpeed: 0.030000014
- _FoamTiling: 0.049999908
- _FoamWaveMask: 0
- _FoamWaveMaskExp: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _HorizonDistance: 7.6
- _IntersectionClipping: 0.428
- _IntersectionFalloff: 1
- _IntersectionLength: 1.79
- _IntersectionRippleDist: 64
- _IntersectionRippleStrength: 0.355
- _IntersectionSize: 0.944
- _IntersectionSource: 0
- _IntersectionSpeed: 0.06000001
- _IntersectionStyle: 1
- _IntersectionTiling: 0.16999984
- _IntersectionWaveDist: 33.28
- _LightingMode: 0
- _LightingOn: 0
- _Metallic: 0
- _Metallicness: 0.1
- _NORMALMAPOn: 1
- _NormalMap: 1
- _NormalMapOn: 1
- _NormalSpeed: 0.2
- _NormalStrength: 1
- _NormalTiling: 0.29999992
- _OcclusionStrength: 1
- _PlanarReflectionsEnabled: 0
- _PlanarReflectionsParams: 0
- _PointSpotLightReflectionDistortion: 0.5
- _PointSpotLightReflectionExp: 64
- _PointSpotLightReflectionSize: 0
- _PointSpotLightReflectionStrength: 10
- _QueueOffset: 0
- _ReceiveShadows: 0
- _ReflectionBlur: 0
- _ReflectionDistortion: 0.086
- _ReflectionFresnel: 5
- _ReflectionFresnelMode: 0
- _ReflectionLighting: 0
- _ReflectionStrength: 0.248
- _Reflectivity: 1
- _RefractionAmount: 0.05
- _RefractionOn: 0
- _RefractionStrength: 0.267
- _RimRize: 1
- _RimTiling: 0.025
- _RiverModeOn: 0
- _SHARP_INERSECTIONOn: 1
- _ShadingMode: 0
- _ShadowStrength: 1
- _ShoreLineLength: 0
- _ShoreLineWaveDistance: 23
- _ShoreLineWaveStr: 1
- _SimpleLighting: 1
- _SlopeFoam: 1
- _SlopeSpeed: 4
- _SlopeStretching: 0.5
- _SlopeThreshold: 0.25
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SparkleIntensity: 4.53
- _SparkleSize: 0.7
- _SpecularHighlights: 1
- _SpecularReflectionsOn: 1
- _Speed: 1
- _SrcBlend: 1
- _SunReflectionDistortion: 0.49
- _SunReflectionPerturbance: 0.548
- _SunReflectionSize: 0.943
- _SunReflectionStrength: 3
- _Surface: 0
- _TEXTURE_INTERSECTIONOn: 0
- _Texture_IntersectionOn: 1
- _Tiling: 0.5
- _Translucency: 0
- _TranslucencyCurvatureMask: 0
- _TranslucencyExp: 4
- _TranslucencyOn: 0
- _TranslucencyReflectionMask: 0
- _TranslucencyStrength: 1
- _UnderwaterRefractionOffset: 0.2
- _UnderwaterSurfaceSmoothness: 0.8
- _VertexColorDepth: 0
- _VertexColorFoam: 0
- _VertexColorWaveFlattening: 0
- _WaveCount: 5
- _WaveDistance: 0.509
- _WaveHeight: 5.48
- _WaveNormalStr: 0.291
- _WaveSpeed: 1
- _WaveSteepness: 0
- _WaveTint: 0.029
- _WavesOn: 1
- _WorkflowMode: 1
- _WorldSpaceUV: 1
- _ZClip: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0, g: 0.16451614, b: 0.34, a: 0.9647059}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _DepthMapBounds: {r: -402.3, g: -459.43, b: 0.0012693577, a: 0}
- _Direction: {r: 1, g: 1, b: 0, a: 0}
- _DistanceNormalsFadeDist: {r: 300, g: 0.25, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 1, g: 1, b: 1, a: 0.09803922}
- _HorizonColor: {r: 0.2352941, g: 0.9051294, b: 1, a: 1}
- _IntersectionColor: {r: 1, g: 1, b: 1, a: 1}
- _RimColor: {r: 1, g: 1, b: 1, a: 1}
- _ShallowColor: {r: 0, g: 0.8446603, b: 1, a: 0.39607844}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
- _WaterColor: {r: 0.21176466, g: 0.6745098, b: 1, a: 1}
- _WaterShallowColor: {r: 0, g: 0.9394503, b: 1, a: 1}
- _WaveDirection: {r: 1, g: 1, b: 1, a: 1}
- _WaveFadeDistance: {r: 150, g: 300, b: 0, a: 0}
m_BuildTextureStacks: []
--- !u!114 &6498140463000427223
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9b3e58c79fd0b4fefabd781bd9000960
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,99 @@
{
"dependencies": {
"com.unity.2d.animation": {
"version": "9.0.3",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.2d.common": "8.0.1",
"com.unity.2d.sprite": "1.0.0",
"com.unity.collections": "1.1.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.uielements": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.2d.aseprite": {
"version": "1.0.0",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.common": "6.0.6",
"com.unity.mathematics": "1.2.6",
"com.unity.modules.animation": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.2d.common": {
"version": "8.0.1",
"depth": 2,
"source": "registry",
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.mathematics": "1.1.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.burst": "1.7.3"
},
"url": "https://packages.unity.com"
},
"com.unity.2d.pixel-perfect": {
"version": "5.0.3",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.2d.psdimporter": {
"version": "8.0.2",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.2d.animation": "9.0.1",
"com.unity.2d.common": "8.0.1",
"com.unity.2d.sprite": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.2d.sprite": {
"version": "1.0.0",
"depth": 1,
"source": "builtin",
"dependencies": {}
},
"com.unity.2d.spriteshape": {
"version": "9.0.2",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.mathematics": "1.1.0",
"com.unity.2d.common": "8.0.1",
"com.unity.modules.physics2d": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.2d.tilemap": {
"version": "1.0.0",
"depth": 1,
"source": "builtin",
"dependencies": {
"com.unity.modules.tilemap": "1.0.0",
"com.unity.modules.uielements": "1.0.0"
}
},
"com.unity.2d.tilemap.extras": {
"version": "3.1.1",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.modules.tilemap": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.ugui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.addressables": {
"version": "1.21.14",
"depth": 0,
@ -24,7 +118,7 @@
"url": "https://packages.unity.com"
},
"com.unity.burst": {
"version": "1.8.4",
"version": "1.8.7",
"depth": 1,
"source": "registry",
"dependencies": {
@ -48,6 +142,16 @@
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.collections": {
"version": "1.2.4",
"depth": 2,
"source": "registry",
"dependencies": {
"com.unity.burst": "1.6.6",
"com.unity.test-framework": "1.1.31"
},
"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.6",
"depth": 1,