Browse Source

Menu Finished

SionAraAra 4 days ago
parent
commit
eb57fb1ef6

+ 8 - 0
Valley_Runner/Assets/Prefabs.meta

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

+ 8 - 0
Valley_Runner/Assets/Props.meta

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

File diff suppressed because it is too large
+ 2797 - 22
Valley_Runner/Assets/Scenes/Game.unity


+ 54 - 9
Valley_Runner/Assets/Scenes/Menu.unity

@@ -542,8 +542,8 @@ RectTransform:
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 1339384769}
-  - {fileID: 1631296125}
   - {fileID: 681555691}
+  - {fileID: 1631296125}
   m_Father: {fileID: 1226121623}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
@@ -773,6 +773,7 @@ GameObject:
   - component: {fileID: 621380911}
   - component: {fileID: 621380910}
   - component: {fileID: 621380909}
+  - component: {fileID: 621380912}
   m_Layer: 0
   m_Name: Main Camera
   m_TagString: MainCamera
@@ -854,6 +855,50 @@ Transform:
   m_Children: []
   m_Father: {fileID: 0}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &621380912
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 621380908}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_RenderShadows: 1
+  m_RequiresDepthTextureOption: 2
+  m_RequiresOpaqueTextureOption: 2
+  m_CameraType: 0
+  m_Cameras: []
+  m_RendererIndex: -1
+  m_VolumeLayerMask:
+    serializedVersion: 2
+    m_Bits: 1
+  m_VolumeTrigger: {fileID: 0}
+  m_VolumeFrameworkUpdateModeOption: 2
+  m_RenderPostProcessing: 0
+  m_Antialiasing: 0
+  m_AntialiasingQuality: 2
+  m_StopNaN: 0
+  m_Dithering: 0
+  m_ClearDepth: 1
+  m_AllowXRRendering: 1
+  m_AllowHDROutput: 1
+  m_UseScreenCoordOverride: 0
+  m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
+  m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
+  m_RequiresDepthTexture: 0
+  m_RequiresColorTexture: 0
+  m_Version: 2
+  m_TaaSettings:
+    m_Quality: 3
+    m_FrameInfluence: 0.1
+    m_JitterScale: 1
+    m_MipBias: 0
+    m_VarianceClampScale: 0.9
+    m_ContrastAdaptiveSharpening: 0
 --- !u!1 &622043631
 GameObject:
   m_ObjectHideFlags: 0
@@ -1043,7 +1088,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   m_Navigation:
-    m_Mode: 3
+    m_Mode: 1
     m_WrapAround: 0
     m_SelectOnUp: {fileID: 0}
     m_SelectOnDown: {fileID: 0}
@@ -1075,9 +1120,9 @@ MonoBehaviour:
   m_HandleRect: {fileID: 1896762329}
   m_Direction: 0
   m_MinValue: 0
-  m_MaxValue: 1
-  m_WholeNumbers: 0
-  m_Value: 0
+  m_MaxValue: 100
+  m_WholeNumbers: 1
+  m_Value: 10
   m_OnValueChanged:
     m_PersistentCalls:
       m_Calls: []
@@ -1592,7 +1637,7 @@ RectTransform:
   m_Father: {fileID: 1731887755}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 1}
+  m_AnchorMax: {x: 0.1, y: 1}
   m_AnchoredPosition: {x: 0, y: 0}
   m_SizeDelta: {x: 10, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
@@ -2393,7 +2438,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}
   m_AnchorMax: {x: 0.5, y: 0.5}
-  m_AnchoredPosition: {x: 0, y: -188}
+  m_AnchoredPosition: {x: 0, y: -193}
   m_SizeDelta: {x: 160, y: 30}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1631296126
@@ -3207,8 +3252,8 @@ RectTransform:
   m_Children: []
   m_Father: {fileID: 2031527309}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 1}
+  m_AnchorMin: {x: 0.1, y: 0}
+  m_AnchorMax: {x: 0.1, y: 1}
   m_AnchoredPosition: {x: 0, y: 0}
   m_SizeDelta: {x: 20, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}

+ 31 - 4
Valley_Runner/Assets/Scripts/GameData.cs

@@ -4,14 +4,41 @@ using System.Collections.Generic;
 [System.Serializable]
 public class GameData
 {
-    public int score;
-    public int difficulty;
+    public float playerPosX;
+    public float playerPosY;
+    public float playerPosZ;
+    
+    public float playerRotX;
+    public float playerRotY;
+    public float playerRotZ;
+    
+    public int orbsCollected;
+
+    public float seed;
+
+    public int[] orbs;
+    
+    
+    public bool isGameActive;
+    public int timeRemaining;
+
+    public int settings;
+    
 
 
     public GameData(GameManager gameManager)
     {
-        score = gameManager.score;
-        difficulty = gameManager.diff;
+        playerPosX = gameManager.playerPosX;
+        playerPosY = gameManager.playerPosY;
+        playerPosZ = gameManager.playerPosZ;
+        playerRotX = gameManager.playerRotX;
+        playerRotY = gameManager.playerRotY;
+        playerRotZ = gameManager.playerRotZ;
+        orbsCollected = gameManager.orbsCollected;
+        seed = gameManager.seed;
+        isGameActive = gameManager.isGameActive;
+        timeRemaining = gameManager.timeRemaining;
+        settings = gameManager.settings;
     }
         
 }

+ 84 - 38
Valley_Runner/Assets/Scripts/GameManager.cs

@@ -8,17 +8,37 @@ using UnityEngine;
 
 public class GameManager : MonoBehaviour
 {
-    public List<GameObject> targets;
-    public int score;
-    public TextMeshProUGUI scoreText;
-    public TextMeshProUGUI gameOverText;
-    private float spawnRate = 1.0f;
-    public Button restartButton;
+    
+    public TextMeshProUGUI timeRemainingText;
+    public TextMeshProUGUI orbsCollectedText;
+    
     public bool isGameActive;
-    public GameObject titleScreen;
+    public GameObject GameOverScreen;
+    public GameObject VictoryScreen;
+    
+    public float playerPosX;
+    public float playerPosY;
+    public float playerPosZ;
+    
+    public float playerRotX;
+    public float playerRotY;
+    public float playerRotZ;
+    
+    public int orbsCollected = 0;
+
+    public float seed;
+
+    public List<GameObject> orbs;
+    
+    
+
+    public int timeRemaining = 20;
+
+    public int settings;
+    
     
-    //for safe and load
-    public int diff;
+    
+        
     // Start is called once before the first execution of Update after the MonoBehaviour is created
     void Start()
     {
@@ -29,12 +49,8 @@ public class GameManager : MonoBehaviour
     public void StartGame(int difficulty)
     {
         isGameActive = true;
-        StartCoroutine(SpawnTarget());
-        score = 0;
-        UpdateScore(0);
-        titleScreen.gameObject.SetActive(false);
-        spawnRate /= difficulty;
-        diff = difficulty;
+        
+        
     }
 
     public void RestartGame()
@@ -43,26 +59,18 @@ public class GameManager : MonoBehaviour
     }
     public void GameOver()
     {
-        gameOverText.gameObject.SetActive(true);
-        restartButton.gameObject.SetActive(true);
+        GameOverScreen.SetActive(true);
+        
         isGameActive = false;
     }
-        IEnumerator SpawnTarget()
-        {
-            while (isGameActive)
-            {
-                yield return new WaitForSeconds(spawnRate);
-                int index = Random.Range(0, targets.Count);
-                Instantiate(targets[index]);
-                
-            }
-        }
 
-        public void UpdateScore(int scoreToAdd)
-        {
-            score += scoreToAdd;
-            scoreText.text = "Score: " + score;
-        }
+    public void Victory()
+    {
+        VictoryScreen.SetActive(true);
+        isGameActive = false;
+    }
+        
+
 
 
         public void SaveGame()
@@ -77,24 +85,62 @@ public class GameManager : MonoBehaviour
             GameData data = SaveSystem.LoadGame();
 
 
-            score = data.score;
-            scoreText.text = "Score: " + score;
-            diff=data.difficulty;
-
+            playerPosX = data.playerPosX;
+            playerPosY = data.playerPosY;
+            playerPosZ = data.playerPosZ;
+            playerRotX = data.playerRotX;
+            playerRotY = data.playerRotY;
+            playerRotZ = data.playerRotZ;
+            orbsCollected = data.orbsCollected;
+            seed = data.seed;
+            for (int i = 0; i < orbs.Count; i++)
+            {
+                
+            }
+            isGameActive = data.isGameActive;
+            timeRemaining = data.timeRemaining;
+            settings = data.settings;
         }
     // Update is called once per frame
     void Update()
     {
-        if(Input.GetKeyDown(KeyCode.Q))
+        UpdateTimeRemaining();
+        //Victory
+        if (orbsCollected == orbs.Count)
+        {
+            Victory();
+        }
+        
+        //Game Over
+        if (timeRemaining == 0)
+        {
+            GameOver();
+        }
+        
+        
+        
+        if(Input.GetKeyDown(KeyCode.F5))
         {
             SaveGame();
         }
         
-        if(Input.GetKeyDown(KeyCode.E))
+        if(Input.GetKeyDown(KeyCode.F9))
         {
             LoadGame();
         }
     }
+
+    public void UpdateTimeRemaining()
+    {
+        timeRemaining--;
+        timeRemainingText.text = "RemainingTime: " +  timeRemaining * Time.deltaTime;
+    }
+
+    public void UpdateCollectedOrbs()
+    {
+        orbsCollected++;
+        orbsCollectedText.text = "Collected Orbs: " + orbsCollected;
+    }
 }
 
 

+ 26 - 0
Valley_Runner/Assets/Scripts/Orbs.cs

@@ -0,0 +1,26 @@
+using UnityEngine;
+
+public class Orbs : MonoBehaviour
+{
+
+    public float orbPosX;
+    public float orbPosY;
+    public float orbPosZ;
+    
+    public float orbRotX;
+    public float orbRotY;
+    public float orbRotZ;
+
+    public bool isCollected;
+    // 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()
+    {
+        
+    }
+}

+ 2 - 0
Valley_Runner/Assets/Scripts/Orbs.cs.meta

@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 9f46e8b33df7f9740ac50db17dae861e

+ 19 - 0
Valley_Runner/Assets/Scripts/PauseMenu.cs

@@ -4,6 +4,7 @@ public class PauseMenu : MonoBehaviour
 {
     public static bool GameIsPaused = false;
     public GameObject PauseMenuUI;
+    public GameManager gameManager;
     void Update()
     {
         if (Input.GetKeyDown(KeyCode.Escape))
@@ -41,5 +42,23 @@ public class PauseMenu : MonoBehaviour
         PauseMenuUI.SetActive(true);
         Time.timeScale = 0;
         GameIsPaused = true;
+    }
+    
+    public void SaveGame()
+    {
+        Debug.Log("Save Game");
+        SaveSystem.SaveGame(gameManager);
+    }
+
+
+
+    public void LoadGame()
+    {
+        Debug.Log("Load Game");
+        GameData data = SaveSystem.LoadGame();
+
+
+        
+
     }
 }

+ 16 - 0
Valley_Runner/Assets/Scripts/PlayerMovement.cs

@@ -0,0 +1,16 @@
+using UnityEngine;
+
+public class PlayerMovement : 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()
+    {
+        
+    }
+}

+ 2 - 0
Valley_Runner/Assets/Scripts/PlayerMovement.cs.meta

@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 1b3925ec7f0f4374099709a987aefaeb

Some files were not shown because too many files changed in this diff