diff --git a/playable/Assets/Music/Piñata Sounds.rar b/playable/Assets/Music/Piñata Sounds.rar deleted file mode 100644 index e5bbdd0..0000000 Binary files a/playable/Assets/Music/Piñata Sounds.rar and /dev/null differ diff --git a/playable/Assets/Music/Piñata Sounds.rar.meta b/playable/Assets/Music/Piñata Sounds.rar.meta deleted file mode 100644 index a7591a9..0000000 --- a/playable/Assets/Music/Piñata Sounds.rar.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 382f6c8c22ea2804d9e143e6985d85bb -DefaultImporter: - userData: diff --git a/playable/Assets/Prefabs/GameStuff.prefab b/playable/Assets/Prefabs/GameStuff.prefab index c8a969c..e047e03 100644 Binary files a/playable/Assets/Prefabs/GameStuff.prefab and b/playable/Assets/Prefabs/GameStuff.prefab differ diff --git a/playable/Assets/Prefabs/PinatatFrac 1.prefab b/playable/Assets/Prefabs/PinatatFrac 1.prefab new file mode 100644 index 0000000..4213f70 Binary files /dev/null and b/playable/Assets/Prefabs/PinatatFrac 1.prefab differ diff --git a/playable/Assets/Prefabs/PinatatFrac 1.prefab.meta b/playable/Assets/Prefabs/PinatatFrac 1.prefab.meta new file mode 100644 index 0000000..820bb6c --- /dev/null +++ b/playable/Assets/Prefabs/PinatatFrac 1.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 527a72be3702f2345a606bbe21ff075a +NativeFormatImporter: + userData: diff --git a/playable/Assets/Prefabs/Players.prefab b/playable/Assets/Prefabs/Players.prefab new file mode 100644 index 0000000..e8eca4c Binary files /dev/null and b/playable/Assets/Prefabs/Players.prefab differ diff --git a/playable/Assets/Prefabs/Players.prefab.meta b/playable/Assets/Prefabs/Players.prefab.meta new file mode 100644 index 0000000..c808135 --- /dev/null +++ b/playable/Assets/Prefabs/Players.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a5254e11385551e45a99cb184f6309c0 +NativeFormatImporter: + userData: diff --git a/playable/Assets/Prefabs/candy.prefab b/playable/Assets/Prefabs/candy.prefab index 6dda2c9..055c946 100644 Binary files a/playable/Assets/Prefabs/candy.prefab and b/playable/Assets/Prefabs/candy.prefab differ diff --git a/playable/Assets/Scenes/Level2.unity b/playable/Assets/Scenes/Level2.unity index 9132ac0..ca17a44 100644 Binary files a/playable/Assets/Scenes/Level2.unity and b/playable/Assets/Scenes/Level2.unity differ diff --git a/playable/Assets/Scripts/CDscript.cs b/playable/Assets/Scripts/CDscript.cs index 5d285c1..f70f52e 100644 --- a/playable/Assets/Scripts/CDscript.cs +++ b/playable/Assets/Scripts/CDscript.cs @@ -3,28 +3,40 @@ using System.Collections; public class CDscript : MonoBehaviour { - public bool pause = false; + public bool pause = true; public float startCount = 5.0f; // Use this for initialization void Start () { - Time.timeScale = 0; - startCount -= Time.deltaTime; pause = true; } // Update is called once per frame void Update () { - if (startCount >=1.0f){ + if (pause){ + startCount -= Time.unscaledDeltaTime; + Time.timeScale = 0; Debug.Log ("cd"); } - + /*if (startCount >=4.0f && <4.9f){ + + } + if (startCount >=3.0f && <3.9f){ + + } + if (startCount >=2.0f && <2.9f){ + + } + if (startCount >=1.0f && <1.9f){ + + } + if (startCount >=0.0f && <0.9f){ + + }*/ if (startCount <=0){ pause = false; - } - - if (pause = false){ Time.timeScale = 1; + startCount = startCount + 5.0f; } } } \ No newline at end of file diff --git a/playable/Assets/Scripts/PlayerExplosion.cs b/playable/Assets/Scripts/PlayerExplosion.cs new file mode 100644 index 0000000..4456cf6 --- /dev/null +++ b/playable/Assets/Scripts/PlayerExplosion.cs @@ -0,0 +1,45 @@ +using UnityEngine; +using System.Collections; + +public class PlayerExplosion : MonoBehaviour { + + public float explosionDistance; + public float explosionTime; + + public int fraqAmount = 0; + + // Use this for initialization + void Start () { + + foreach (Transform child in transform) + { + fraqAmount++; + StartCoroutine (explosion (child)); + } + + } + + // Update is called once per frame + void Update () { + + } + + IEnumerator explosion(Transform debris){ + Vector3 centre = transform.position; + Vector3 scaleDirection = debris.position - centre; + Debug.Log ("Scale Direction" + scaleDirection); + + for (float i = 0; i < 1; i += Time.deltaTime/explosionTime) { + debris.position =centre +( scaleDirection * Mathf.Lerp (1, explosionDistance, i)); + + yield return null; + } + + fraqAmount--; + + if (fraqAmount == 0) { + Destroy(gameObject,0.0f); + } + + } +} diff --git a/playable/Assets/Scripts/PlayerExplosion.cs.meta b/playable/Assets/Scripts/PlayerExplosion.cs.meta new file mode 100644 index 0000000..015a2c0 --- /dev/null +++ b/playable/Assets/Scripts/PlayerExplosion.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0f4be3bad839bf744aef5ca4e467a8f3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/playable/Assets/Scripts/collectable.cs b/playable/Assets/Scripts/collectable.cs index 443f49b..832a049 100644 --- a/playable/Assets/Scripts/collectable.cs +++ b/playable/Assets/Scripts/collectable.cs @@ -2,9 +2,13 @@ using System.Collections; public class collectable : MonoBehaviour { + + public float waitTime; + float startTime; // Use this for initialization void Start () { + startTime = Time.time; float rand = Random.Range (0, 7); int randColour = Mathf.FloorToInt (rand); @@ -39,5 +43,8 @@ public class collectable : MonoBehaviour { // Update is called once per frame void Update () { transform.Rotate (new Vector3 (15, 30, 45) * Time.deltaTime); + if (waitTime < Time.time - startTime) { + gameObject.GetComponent().enabled = true; + } } } diff --git a/playable/Assets/Scripts/playerController.cs b/playable/Assets/Scripts/playerController.cs index 087b4b2..e5e62d9 100644 --- a/playable/Assets/Scripts/playerController.cs +++ b/playable/Assets/Scripts/playerController.cs @@ -18,6 +18,7 @@ public class playerController : MonoBehaviour { public GUIText scoreDisplay; public GUIText gameOverDisplay; public GameObject dashDisplay; + public GameObject playerFrac; public float runSpeed; //run speed public float jumpHeight; //jump height @@ -31,6 +32,11 @@ public class playerController : MonoBehaviour { public float dashTime; public float dashWait; public float minY; + public bool heartBlack = false; + public bool heartColor = true; + public bool dead = false; + public float heartTimer = 0.0f; + private float displayedHealth = 3; //currently displayed health @@ -48,13 +54,15 @@ public class playerController : MonoBehaviour { private float lastDash = 0.0f; private bool stopDash = false; public float deathTimer = 3.0f; - bool droppedCandy = false; - public bool heartBlack = false; - public bool heartColor = true; - public bool dead = false; - public float heartTimer = 0.0f; + public bool droppedCandy = false; + private float volume = 1.0f; + private bool exploded = false; + + + + void Start(){ @@ -190,14 +198,24 @@ public class playerController : MonoBehaviour { if (heartTimer >=2.5f){ health = 2; } + if (!exploded){ + + exploded = true; + Vector3 fracRotation = transform.rotation.eulerAngles; + fracRotation.y +=90; + GameObject explosion = Instantiate (playerFrac, transform.position+(Vector3.up*-3), Quaternion.Euler(fracRotation)) as GameObject; + } + } if (deathTimer > 0) { deathTimer -= Time.deltaTime; if (!droppedCandy) { Instantiate (newCandy, transform.position + Vector3.up, transform.rotation); + Debug.Log ("Exploded position: " + transform.position); + droppedCandy = true; } - transform.position = new Vector3 (0, -50, 0); + transform.position = new Vector3 (10, -50, 0); if (deathTimer <= 0) { Vector3 spawnPos = new Vector3 (Random.Range (-20.0f, 20.0f), 15.0f, 0); //picks random position health = 3; //resets life @@ -210,6 +228,7 @@ public class playerController : MonoBehaviour { heartBlack = false; dead = false; heartColor = true; + exploded = false; } }//end if @@ -338,7 +357,7 @@ public class playerController : MonoBehaviour { Debug.Log (trig.gameObject.tag); if (trig.gameObject.tag == "candy") { - trig.gameObject.SetActive (false); + Destroy (trig.gameObject, 0.0f); score++; scoreDisplay.text = "score: " + score.ToString (); } diff --git a/playable/ProjectSettings/InputManager.asset b/playable/ProjectSettings/InputManager.asset index 95e0428..633b3db 100644 Binary files a/playable/ProjectSettings/InputManager.asset and b/playable/ProjectSettings/InputManager.asset differ diff --git a/playable/ProjectSettings/TimeManager.asset b/playable/ProjectSettings/TimeManager.asset index 6a2964f..7632e16 100644 Binary files a/playable/ProjectSettings/TimeManager.asset and b/playable/ProjectSettings/TimeManager.asset differ