Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
4ae5858dd8
153
blueberryPeak/Assets/Materials/Terrain/WindMaterial.mat
Normal file
153
blueberryPeak/Assets/Materials/Terrain/WindMaterial.mat
Normal file
@ -0,0 +1,153 @@
|
||||
%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: WindMaterial
|
||||
m_Shader: {fileID: -6465566751694194690, guid: 6ec9b3c213ee8974e943a7e5bfb49b7b, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses:
|
||||
- MOTIONVECTORS
|
||||
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: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
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}
|
||||
- _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}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
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}
|
||||
- _Texture:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _Texture2:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AddPrecomputedVelocity: 0
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 0
|
||||
- _BlendFalloff: 0.68
|
||||
- _BlendHeight: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _Max: 1
|
||||
- _Metallic: 0
|
||||
- _Min: 1.35
|
||||
- _Noise_Intnsity: 55.44
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.005
|
||||
- _QueueControl: 0
|
||||
- _QueueOffset: 0
|
||||
- _RECEIVE_SHADOWS_OFF: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _Shades: 0.69
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _WobbleAmount: 0.5
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
- _time: 0
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
--- !u!114 &3137067232266988487
|
||||
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: 9
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3edcc8356c52287479e646127f3d9c91
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -118,6 +118,10 @@ PrefabInstance:
|
||||
propertyPath: m_ConstrainProportionsScale
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7511558181221131132, guid: b45a6da6d07c04011ad3ab5a5ada757d, type: 3}
|
||||
propertyPath: 'm_Materials.Array.data[0]'
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: e262cd8456abb43ef97dd23c6dadf6e8, type: 2}
|
||||
- target: {fileID: 919132149155446097, guid: b45a6da6d07c04011ad3ab5a5ada757d, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Model
|
||||
|
267
blueberryPeak/Assets/Prefabs/windVisualizer.prefab
Normal file
267
blueberryPeak/Assets/Prefabs/windVisualizer.prefab
Normal file
@ -0,0 +1,267 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3559428636518006151
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2863246547369485301}
|
||||
- component: {fileID: 909831313759188180}
|
||||
m_Layer: 0
|
||||
m_Name: Wind
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2863246547369485301
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3559428636518006151}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7284533660636149935}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!96 &909831313759188180
|
||||
TrailRenderer:
|
||||
serializedVersion: 3
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3559428636518006151}
|
||||
m_Enabled: 0
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 0
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 0
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 3edcc8356c52287479e646127f3d9c91, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Time: 0.5
|
||||
m_PreviewTimeScale: 1
|
||||
m_Parameters:
|
||||
serializedVersion: 3
|
||||
widthMultiplier: 1
|
||||
widthCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0.25
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
colorGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 1}
|
||||
key1: {r: 1, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_ColorSpace: -1
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
numCornerVertices: 0
|
||||
numCapVertices: 0
|
||||
alignment: 0
|
||||
textureMode: 0
|
||||
textureScale: {x: 1, y: 1}
|
||||
shadowBias: 0.5
|
||||
generateLightingData: 0
|
||||
m_MinVertexDistance: 0.1
|
||||
m_MaskInteraction: 0
|
||||
m_Autodestruct: 0
|
||||
m_Emitting: 1
|
||||
m_ApplyActiveColorSpace: 1
|
||||
--- !u!1 &4701400903227451376
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3692384260631973351}
|
||||
m_Layer: 0
|
||||
m_Name: End
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3692384260631973351
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4701400903227451376}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 13.3, y: 0, z: -47.7}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7284533660636149935}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &5278576379875597895
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5360626034533635441}
|
||||
m_Layer: 0
|
||||
m_Name: Start
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5360626034533635441
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5278576379875597895}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 14, y: 0, z: 43.7}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7284533660636149935}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &8608373587901890409
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7284533660636149935}
|
||||
- component: {fileID: 2566609064828820021}
|
||||
m_Layer: 0
|
||||
m_Name: windVisualizer
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7284533660636149935
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8608373587901890409}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 2.137, y: 7.88, z: 0.23045453}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5360626034533635441}
|
||||
- {fileID: 3692384260631973351}
|
||||
- {fileID: 2863246547369485301}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2566609064828820021
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8608373587901890409}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bbdd2a21fdfa1704598a7bde96e184e9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
windTransform: {fileID: 2863246547369485301}
|
||||
windStart: {fileID: 5360626034533635441}
|
||||
windEnd: {fileID: 3692384260631973351}
|
||||
windSpeed: 14
|
||||
curveAmplitude: 1.4
|
||||
curveFrequency: 1.52
|
||||
trailRenderer: {fileID: 909831313759188180}
|
||||
initialPhaseOffset: 0
|
7
blueberryPeak/Assets/Prefabs/windVisualizer.prefab.meta
Normal file
7
blueberryPeak/Assets/Prefabs/windVisualizer.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 516c864ed85751e4dab9f81f7abbf982
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
8
blueberryPeak/Assets/Scripts/Audio.meta
Normal file
8
blueberryPeak/Assets/Scripts/Audio.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d5ce487abcd5134a8b3bde195f9b184
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
91
blueberryPeak/Assets/Scripts/Helper/WindVisualizer.cs
Normal file
91
blueberryPeak/Assets/Scripts/Helper/WindVisualizer.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class WindVisualizer : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform windTransform; // The object that will move (e.g., your LineRenderer GameObject)
|
||||
[SerializeField] private Transform windStart; // The starting point of the wind path
|
||||
[SerializeField] private Transform windEnd; // The ending point of the wind path
|
||||
[SerializeField] private float windSpeed = 1.0f; // Controls how fast the wind moves along the path
|
||||
[SerializeField] private float curveAmplitude = 1.0f; // How high/wide the sine curve is
|
||||
[SerializeField] private float curveFrequency = 1.0f; // How many waves are in the path
|
||||
[SerializeField] private TrailRenderer trailRenderer; // How many waves are in the path
|
||||
[SerializeField] private float initialPhaseOffset = 0f; // To offset the start time for multiple wind effects
|
||||
|
||||
private float previousNormalizedTime = 0f; // To detect when the loop restarts
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
// Basic validation
|
||||
if (windTransform == null || windStart == null || windEnd == null)
|
||||
{
|
||||
Debug.LogError("WindVisualizer: 'windTransform', 'windStart', or 'windEnd' is not assigned. Please assign them in the Inspector.", this);
|
||||
enabled = false; // Disable the script if essential components are missing
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
trailRenderer.enabled = true;
|
||||
if (windTransform == null || windStart == null || windEnd == null)
|
||||
{
|
||||
return; // Don't proceed if validation failed in Start
|
||||
}
|
||||
|
||||
// Calculate the length of the path
|
||||
float pathLength = Vector3.Distance(windStart.position, windEnd.position);
|
||||
if (pathLength == 0) // Avoid division by zero if start and end are at the same position
|
||||
{
|
||||
windTransform.position = windStart.position; // Stay at start
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate a normalized position along the path (0 to 1, then loops back to 0)
|
||||
float currentPathTime = (Time.time + initialPhaseOffset) * windSpeed / pathLength;
|
||||
float normalizedTime = Mathf.Repeat(currentPathTime, 1f); // Loops between 0 and 1
|
||||
|
||||
// --- Function Call Logic ---
|
||||
// If normalizedTime has wrapped around (i.e., it was high and now it's low),
|
||||
// it means the windTransform has logically reached the end and "jumped" back to the start.
|
||||
if (normalizedTime < previousNormalizedTime)
|
||||
{
|
||||
OnWindCycleComplete(); // Call your function here
|
||||
}
|
||||
previousNormalizedTime = normalizedTime; // Store for the next frame's comparison
|
||||
// --- End Function Call Logic ---
|
||||
|
||||
|
||||
// Get the straight-line position between start and end based on normalizedTime
|
||||
Vector3 straightLinePosition = Vector3.Lerp(windStart.position, windEnd.position, normalizedTime);
|
||||
|
||||
// Calculate the direction vector from start to end
|
||||
Vector3 pathDirection = (windEnd.position - windStart.position).normalized;
|
||||
|
||||
// Find a perpendicular direction for the sine wave offset
|
||||
Vector3 perpendicularDirection = Vector3.Cross(pathDirection, Vector3.forward);
|
||||
if (perpendicularDirection == Vector3.zero)
|
||||
{
|
||||
perpendicularDirection = Vector3.up;
|
||||
}
|
||||
perpendicularDirection.Normalize();
|
||||
|
||||
// Calculate the sine wave offset
|
||||
float sineInput = normalizedTime * curveFrequency * Mathf.PI * 2 + Time.time;
|
||||
float sineOffset = Mathf.Sin(sineInput) * curveAmplitude;
|
||||
|
||||
// Apply the sine offset to the straight-line position
|
||||
windTransform.position = straightLinePosition + perpendicularDirection * sineOffset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function is called every time the wind visualizer completes a full cycle
|
||||
/// (i.e., it reaches the end position and resets to the start).
|
||||
/// </summary>
|
||||
private void OnWindCycleComplete()
|
||||
{
|
||||
trailRenderer.enabled = false;
|
||||
Instantiate(this.gameObject, transform.position, transform.rotation);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbdd2a21fdfa1704598a7bde96e184e9
|
8
blueberryPeak/Assets/Scripts/Player.meta
Normal file
8
blueberryPeak/Assets/Scripts/Player.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19838b12d3900854b92c5e7e13cc75a9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -14,10 +14,15 @@ public class DialogManager : MonoBehaviour
|
||||
dialogPanel.SetActive(false); // Hide on start
|
||||
}
|
||||
|
||||
Coroutine dialogCoroutine = null;
|
||||
public void ShowDialog(string message)
|
||||
{
|
||||
print("should be showing dialog");
|
||||
StartCoroutine(ShowDialogCoroutine(message));
|
||||
if (dialogCoroutine != null)
|
||||
{
|
||||
StopCoroutine(dialogCoroutine);
|
||||
}
|
||||
dialogCoroutine = StartCoroutine(ShowDialogCoroutine(message));
|
||||
dialogPanel.SetActive(true);
|
||||
playerMovement.moveAllowed = false;
|
||||
}
|
||||
@ -35,6 +40,8 @@ public class DialogManager : MonoBehaviour
|
||||
// KRAUSI MACH SOUND HIER DRINNE REIN PRO LETTER
|
||||
yield return new WaitForSeconds(0.05f); // Wait for a short duration before showing the next letter
|
||||
}
|
||||
|
||||
dialogCoroutine = null;
|
||||
}
|
||||
|
||||
public void HideDialog()
|
@ -31,16 +31,22 @@ public class PlayerInteraction : MonoBehaviour
|
||||
dialogManager = dialogManagerObject.GetComponent<DialogManager>();
|
||||
}
|
||||
|
||||
private bool talking = false;
|
||||
void OnInteract(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
if (context.performed && !talking)
|
||||
{
|
||||
|
||||
GameObject speaker = interactableObjects.Count > 0 ? ColliderInteractable() : PhysicsRaycastInteractable();
|
||||
|
||||
dialog = speaker.GetComponent<QuestGiver>().Talk();
|
||||
if (dialog == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// immedeately start the dialog
|
||||
dialogManager.ShowDialog("<b>" + dialog[dialogIndex].speaker + ": " + dialog[dialogIndex].text);
|
||||
talking = true;
|
||||
// skip the 0th dialog entry since it has already been shown
|
||||
dialogIndex++;
|
||||
if (dialogIndex >= dialog.Length)
|
||||
@ -74,7 +80,6 @@ public class PlayerInteraction : MonoBehaviour
|
||||
|
||||
private GameObject ColliderInteractable()
|
||||
{
|
||||
print("test");
|
||||
float closestDistance = float.MaxValue;
|
||||
int pos = -1;
|
||||
for (int i = 0; i < interactableObjects.Count; i++)
|
||||
@ -91,9 +96,9 @@ public class PlayerInteraction : MonoBehaviour
|
||||
|
||||
void onDialogContinue(InputAction.CallbackContext context)
|
||||
{
|
||||
|
||||
if (context.performed && dialog != null)
|
||||
{
|
||||
print("Dialog continue");
|
||||
// scroll the dialog only if there is text to be shown
|
||||
|
||||
print(dialog[dialogIndex].text);
|
||||
@ -105,12 +110,13 @@ public class PlayerInteraction : MonoBehaviour
|
||||
dialogIndex = 0;
|
||||
// reset the dialog to be null so it cannot be scrolled through when not in an interaction
|
||||
dialog = null;
|
||||
talking = false;
|
||||
dialogManager.HideDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collision other)
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
print("outside");
|
||||
if (other.gameObject.tag == "Interactable")
|
||||
@ -119,8 +125,8 @@ public class PlayerInteraction : MonoBehaviour
|
||||
interactableObjects.Add(other.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collision other)
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Interactable")
|
||||
{
|
@ -1,16 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class test : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97b2d6a2aaac4ffdbbd8c5ebfc674d24
|
Loading…
Reference in New Issue
Block a user