diff --git a/Assets/Scripts/Clock.cs b/Assets/Scripts/Clock.cs new file mode 100644 index 0000000..534c0f5 --- /dev/null +++ b/Assets/Scripts/Clock.cs @@ -0,0 +1,22 @@ +using System.Collections; +using System.Collections.Generic; +using System.Security.Cryptography; +using UnityEngine; + +public class Clock : MonoBehaviour +{ + public AudioSource collectSound; + public Transform player; + public SlowDownTime timeSlower; + + void OnTriggerEnter(Collider other) + { + if (other.transform == player) + { + collectSound.Play(); + timeSlower.DoSlowmotion(); + Destroy(gameObject); + } + + } +} diff --git a/Assets/Scripts/Clock.cs.meta b/Assets/Scripts/Clock.cs.meta new file mode 100644 index 0000000..806abda --- /dev/null +++ b/Assets/Scripts/Clock.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 89c2147df4e9eb44f9009e640b2c1278 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Oxygen.cs b/Assets/Scripts/Oxygen.cs new file mode 100644 index 0000000..f1b4a4a --- /dev/null +++ b/Assets/Scripts/Oxygen.cs @@ -0,0 +1,20 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Oxygen : MonoBehaviour +{ + public AudioSource collectSound; + static float oxyLevel; + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Scripts/Oxygen.cs.meta b/Assets/Scripts/Oxygen.cs.meta new file mode 100644 index 0000000..81596fd --- /dev/null +++ b/Assets/Scripts/Oxygen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: db17989c8b7097b418f44cfa79d58803 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/RefillOxygen.cs b/Assets/Scripts/RefillOxygen.cs new file mode 100644 index 0000000..13e09bb --- /dev/null +++ b/Assets/Scripts/RefillOxygen.cs @@ -0,0 +1,20 @@ +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using UnityEngine; + +public class RefillOxygen : MonoBehaviour +{ + public AudioSource collectSound; + public float capacity; + + void OnTriggerEnter(Collider other) + { + if (other.transform == player) + { + collectSound.Play(); + Oxygen.oxyLevel = capacity; + Destroy(gameObject); + } + } +} diff --git a/Assets/Scripts/RefillOxygen.cs.meta b/Assets/Scripts/RefillOxygen.cs.meta new file mode 100644 index 0000000..351bcf0 --- /dev/null +++ b/Assets/Scripts/RefillOxygen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fcda3e8182902b24b956936a5ad088c6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Score.cs b/Assets/Scripts/Score.cs new file mode 100644 index 0000000..9878f14 --- /dev/null +++ b/Assets/Scripts/Score.cs @@ -0,0 +1,23 @@ +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using UnityEngine; + +public class Score : MonoBehaviour +{ + static float scoreRate = 1; + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + if (ScoreMultiplier.hasHit && !Timer.running) + { + scoreRate = 1; + } + } +} diff --git a/Assets/Scripts/Score.cs.meta b/Assets/Scripts/Score.cs.meta new file mode 100644 index 0000000..213f28a --- /dev/null +++ b/Assets/Scripts/Score.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 45a7d41beb60e7141a9f9939c05ce77b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ScoreMultiplier.cs b/Assets/Scripts/ScoreMultiplier.cs new file mode 100644 index 0000000..78be846 --- /dev/null +++ b/Assets/Scripts/ScoreMultiplier.cs @@ -0,0 +1,22 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ScoreMultiplier : MonoBehaviour +{ + public AudioSource collectSound; + public Transform player; + + bool hasHit = false; + + void OnTriggerEnter(Collider other) + { + if (other.transform == player) + { + collectSound.Play(); + Score.scoreRate=2; + hasHit = true; + Destroy(gameObject); + } + } +} diff --git a/Assets/Scripts/ScoreMultiplier.cs.meta b/Assets/Scripts/ScoreMultiplier.cs.meta new file mode 100644 index 0000000..787ad18 --- /dev/null +++ b/Assets/Scripts/ScoreMultiplier.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cedc9b20d36e1574e928c432403d45b5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SlowDownTime.cs b/Assets/Scripts/SlowDownTime.cs new file mode 100644 index 0000000..1ee01e5 --- /dev/null +++ b/Assets/Scripts/SlowDownTime.cs @@ -0,0 +1,19 @@ + +using UnityEngine; + +public class SlowDownTime : MonoBehaviour +{ + public float slowdownFactor = 0.05f; + public float slowdownLength = 2f; + + void Update() + { + Time.timeScale += (1f / slowdownLength) * Time.unscaledDeltaTime ; + Time.timeScale = Mathf.Clamp(Time.timeScale, 0f, 1f); + } + public void DoSlowmotion() + { + Time.timeScale = slowdownFactor; + Time.fixedDeltaTime = Time.timeScale * 0.02f; + } +} diff --git a/Assets/Scripts/SlowDownTime.cs.meta b/Assets/Scripts/SlowDownTime.cs.meta new file mode 100644 index 0000000..5b16245 --- /dev/null +++ b/Assets/Scripts/SlowDownTime.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95f9b319dabcc0149bdb4e6c0547f033 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Teleport.cs b/Assets/Scripts/Teleport.cs new file mode 100644 index 0000000..858d413 --- /dev/null +++ b/Assets/Scripts/Teleport.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Teleport : MonoBehaviour +{ + public AudioSource collectSound; + + Animator m_Animator; + float Width; //width of game window + + void Start() + { + m_Animator = GetComponent; + } + + void OnTriggerEnter(Collider other) + { + m_Animator.enabled = true; + other.transform.position = new Vector3(Random.Range(-Width, Width), 0, other.transform.position.z + 100); + + } +} diff --git a/Assets/Scripts/Teleport.cs.meta b/Assets/Scripts/Teleport.cs.meta new file mode 100644 index 0000000..fbb6813 --- /dev/null +++ b/Assets/Scripts/Teleport.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bea87e74ef118334e80aba0c4a8eda6c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Timer.cs b/Assets/Scripts/Timer.cs new file mode 100644 index 0000000..34c3ec6 --- /dev/null +++ b/Assets/Scripts/Timer.cs @@ -0,0 +1,23 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Timer : MonoBehaviour +{ + static float timedur = 0f; + static bool running = false; + + void Update() + { + if (running) + { + timedur += Time.deltaTime; + } + if (timedur > 100) + { + running = false; + timedur = 0; + } + + } +} diff --git a/Assets/Scripts/Timer.cs.meta b/Assets/Scripts/Timer.cs.meta new file mode 100644 index 0000000..c174a65 --- /dev/null +++ b/Assets/Scripts/Timer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 75870672b9fe1cb458b6fcf44069e5b3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: