Browse Source

Added player explosion,

fixed being able to fix candy by dashing through player
removed random files I accidentally saved in the music folder
master
Joshua Reason 9 years ago
parent
commit
f39f111922
16 changed files with 89 additions and 15 deletions
  1. +0
    -4
      playable/Assets/Music/7z938.exe.meta
  2. BIN
      playable/Assets/Music/Piñata Sounds.rar
  3. +0
    -4
      playable/Assets/Music/Piñata Sounds.rar.meta
  4. BIN
      playable/Assets/Prefabs/GameStuff.prefab
  5. BIN
      playable/Assets/Prefabs/PinatatFrac 1.prefab
  6. +4
    -0
      playable/Assets/Prefabs/PinatatFrac 1.prefab.meta
  7. BIN
      playable/Assets/Prefabs/Players.prefab
  8. +4
    -0
      playable/Assets/Prefabs/Players.prefab.meta
  9. BIN
      playable/Assets/Prefabs/candy.prefab
  10. BIN
      playable/Assets/Scenes/Level1.unity
  11. BIN
      playable/Assets/Scenes/Level2.unity
  12. +45
    -0
      playable/Assets/Scripts/PlayerExplosion.cs
  13. +8
    -0
      playable/Assets/Scripts/PlayerExplosion.cs.meta
  14. +7
    -0
      playable/Assets/Scripts/collectable.cs
  15. +21
    -7
      playable/Assets/Scripts/playerController.cs
  16. BIN
      playable/ProjectSettings/TimeManager.asset

+ 0
- 4
playable/Assets/Music/7z938.exe.meta View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 713681be356b35042b5eca7d16c896a6
DefaultImporter:
userData:

BIN
playable/Assets/Music/Piñata Sounds.rar View File


+ 0
- 4
playable/Assets/Music/Piñata Sounds.rar.meta View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 382f6c8c22ea2804d9e143e6985d85bb
DefaultImporter:
userData:

BIN
playable/Assets/Prefabs/GameStuff.prefab View File


BIN
playable/Assets/Prefabs/PinatatFrac 1.prefab View File


+ 4
- 0
playable/Assets/Prefabs/PinatatFrac 1.prefab.meta View File

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 527a72be3702f2345a606bbe21ff075a
NativeFormatImporter:
userData:

BIN
playable/Assets/Prefabs/Players.prefab View File


+ 4
- 0
playable/Assets/Prefabs/Players.prefab.meta View File

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: a5254e11385551e45a99cb184f6309c0
NativeFormatImporter:
userData:

BIN
playable/Assets/Prefabs/candy.prefab View File


BIN
playable/Assets/Scenes/Level1.unity View File


BIN
playable/Assets/Scenes/Level2.unity View File


+ 45
- 0
playable/Assets/Scripts/PlayerExplosion.cs View File

@ -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);
}
}
}

+ 8
- 0
playable/Assets/Scripts/PlayerExplosion.cs.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0f4be3bad839bf744aef5ca4e467a8f3
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

+ 7
- 0
playable/Assets/Scripts/collectable.cs View File

@ -2,9 +2,13 @@
using System.Collections; using System.Collections;
public class collectable : MonoBehaviour { public class collectable : MonoBehaviour {
public float waitTime;
float startTime;
// Use this for initialization // Use this for initialization
void Start () { void Start () {
startTime = Time.time;
float rand = Random.Range (0, 7); float rand = Random.Range (0, 7);
int randColour = Mathf.FloorToInt (rand); int randColour = Mathf.FloorToInt (rand);
@ -39,5 +43,8 @@ public class collectable : MonoBehaviour {
// Update is called once per frame // Update is called once per frame
void Update () { void Update () {
transform.Rotate (new Vector3 (15, 30, 45) * Time.deltaTime); transform.Rotate (new Vector3 (15, 30, 45) * Time.deltaTime);
if (waitTime < Time.time - startTime) {
gameObject.GetComponent<BoxCollider2D>().enabled = true;
}
} }
} }

+ 21
- 7
playable/Assets/Scripts/playerController.cs View File

@ -18,6 +18,7 @@ public class playerController : MonoBehaviour {
public GUIText scoreDisplay; public GUIText scoreDisplay;
public GUIText gameOverDisplay; public GUIText gameOverDisplay;
public GameObject dashDisplay; public GameObject dashDisplay;
public GameObject playerFrac;
public float runSpeed; //run speed public float runSpeed; //run speed
public float jumpHeight; //jump height public float jumpHeight; //jump height
@ -30,7 +31,11 @@ public class playerController : MonoBehaviour {
public float dashDistance; public float dashDistance;
public float dashTime; public float dashTime;
public float dashWait; public float dashWait;
public float minY;
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 private float displayedHealth = 3; //currently displayed health
@ -49,10 +54,8 @@ public class playerController : MonoBehaviour {
private bool stopDash = false; private bool stopDash = false;
public float deathTimer = 3.0f; public float deathTimer = 3.0f;
bool droppedCandy = false; bool droppedCandy = false;
public bool heartBlack = false;
public bool heartColor = true;
public bool dead = false;
public float heartTimer = 0.0f;
private bool exploded = false;
@ -185,14 +188,24 @@ public class playerController : MonoBehaviour {
if (heartTimer >=2.5f){ if (heartTimer >=2.5f){
health = 2; 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) { if (deathTimer > 0) {
deathTimer -= Time.deltaTime; deathTimer -= Time.deltaTime;
if (!droppedCandy) { if (!droppedCandy) {
Instantiate (newCandy, transform.position + Vector3.up, transform.rotation); Instantiate (newCandy, transform.position + Vector3.up, transform.rotation);
Debug.Log ("Exploded position: " + transform.position);
droppedCandy = true; droppedCandy = true;
} }
transform.position = new Vector3 (0, -50, 0);
transform.position = new Vector3 (10, -50, 0);
if (deathTimer <= 0) { if (deathTimer <= 0) {
Vector3 spawnPos = new Vector3 (Random.Range (-20.0f, 20.0f), 15.0f, 0); //picks random position Vector3 spawnPos = new Vector3 (Random.Range (-20.0f, 20.0f), 15.0f, 0); //picks random position
health = 3; //resets life health = 3; //resets life
@ -205,6 +218,7 @@ public class playerController : MonoBehaviour {
heartBlack = false; heartBlack = false;
dead = false; dead = false;
heartColor = true; heartColor = true;
exploded = false;
} }
}//end if }//end if
@ -333,7 +347,7 @@ public class playerController : MonoBehaviour {
Debug.Log (trig.gameObject.tag); Debug.Log (trig.gameObject.tag);
if (trig.gameObject.tag == "candy") if (trig.gameObject.tag == "candy")
{ {
trig.gameObject.SetActive (false);
Destroy (trig.gameObject, 0.0f);
score++; score++;
scoreDisplay.text = "score: " + score.ToString (); scoreDisplay.text = "score: " + score.ToString ();
} }

BIN
playable/ProjectSettings/TimeManager.asset View File


Loading…
Cancel
Save