Diego Ovalle 5 днів тому
батько
коміт
ab681fca6c

+ 25 - 0
Assets/Scripts/DayNightCycle.cs

@@ -0,0 +1,25 @@
+using UnityEngine;
+
+public class DayNightCycle : MonoBehaviour
+{
+    [Header("Rotation Settings")]
+    public float startRotationX = 10f; // Morning sun angle
+    public float endRotationX = 180f;  // Sunset/Night angle
+
+    void Update()
+    {
+        if (GameManager.Instance != null)
+        {
+            // Calculate how much time has passed as a percentage (0 to 1)
+            float totalDayTime = 300f;
+            float timePassed = totalDayTime - GameManager.Instance.timeRemaining;
+            float timePercentage = timePassed / totalDayTime;
+
+            // Interpolate the rotation from morning to night
+            float currentRotationX = Mathf.Lerp(startRotationX, endRotationX, timePercentage);
+
+            // Apply rotation to the light
+            transform.rotation = Quaternion.Euler(currentRotationX, -30f, 0f);
+        }
+    }
+}

+ 2 - 0
Assets/Scripts/DayNightCycle.cs.meta

@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 3f0294233692bf845b0b8dbe68e50bb1

+ 8 - 0
Assets/Scripts/TerrainGen.meta

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

+ 8 - 0
Assets/Scripts/TerrainGen/Data.meta

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

+ 22 - 0
Assets/Scripts/TerrainGen/Data/NoiseData.asset

@@ -0,0 +1,22 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  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: 3aeef8c80cfc2754a9812f87a4f88250, type: 3}
+  m_Name: NoiseData
+  m_EditorClassIdentifier: Assembly-CSharp::NoiseData
+  autoUpdate: 1
+  normalizeMode: 0
+  noiseScale: 50
+  octaves: 6
+  persistance: 0.471
+  lacunarity: 2
+  seed: 47100
+  offset: {x: 0, y: 0}

+ 8 - 0
Assets/Scripts/TerrainGen/Data/NoiseData.asset.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2b1beb8e27ad94e4bacec12f93ae255f
+NativeFormatImporter:
+  externalObjects: {}
+  mainObjectFileID: 11400000
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 31 - 0
Assets/Scripts/TerrainGen/Data/NoiseData.cs

@@ -0,0 +1,31 @@
+using UnityEngine;
+using System.Collections;
+
+[CreateAssetMenu()]
+public class NoiseData : UpdatableData {
+
+	public Noise.NormalizeMode normalizeMode;
+
+	public float noiseScale;
+
+	public int octaves;
+	[Range(0,1)]
+	public float persistance;
+	public float lacunarity;
+
+	public int seed;
+	public Vector2 offset;
+
+
+	protected override void OnValidate() {
+		if (lacunarity < 1) {
+			lacunarity = 1;
+		}
+		if (octaves < 0) {
+			octaves = 0;
+		}
+
+		base.OnValidate ();
+	}
+
+}

+ 2 - 0
Assets/Scripts/TerrainGen/Data/NoiseData.cs.meta

@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 3aeef8c80cfc2754a9812f87a4f88250

+ 52 - 0
Assets/Scripts/TerrainGen/Data/TerrainData.asset

@@ -0,0 +1,52 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  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: 3e58966cac1e5cf4ab890428775e4535, type: 3}
+  m_Name: TerrainData
+  m_EditorClassIdentifier: Assembly-CSharp::TerrainData
+  autoUpdate: 1
+  uniformScale: 2.5
+  useFlatShading: 0
+  useFalloff: 0
+  meshHeightMultiplier: 25
+  meshHeightCurve:
+    serializedVersion: 2
+    m_Curve:
+    - serializedVersion: 3
+      time: 0
+      value: 0
+      inSlope: 0
+      outSlope: 0
+      tangentMode: 0
+      weightedMode: 0
+      inWeight: 0
+      outWeight: 0
+    - serializedVersion: 3
+      time: 0.39506042
+      value: 0.10812193
+      inSlope: 0.6648412
+      outSlope: 0.6648412
+      tangentMode: 0
+      weightedMode: 0
+      inWeight: 0.33333334
+      outWeight: 0.33333334
+    - serializedVersion: 3
+      time: 1
+      value: 1
+      inSlope: 2
+      outSlope: 2
+      tangentMode: 0
+      weightedMode: 0
+      inWeight: 0
+      outWeight: 0
+    m_PreInfinity: 2
+    m_PostInfinity: 2
+    m_RotationOrder: 4