Browse Source

Merge branch 'master' of https://bitbucket.org/JoshuaReason/pi-ata-smackdown

Conflicts:
	playable/Assets/Scenes/Level1.unity
	playable/Assets/Scenes/Level2.unity
	playable/Assets/Scripts/playerController.cs
master
unknown 9 years ago
parent
commit
fab709a000
16 changed files with 114 additions and 19 deletions
  1. BIN
      playable/Assets/Music/Piñata Sounds.rar
  2. +0
    -4
      playable/Assets/Music/Piñata Sounds.rar.meta
  3. BIN
      playable/Assets/Prefabs/GameStuff.prefab
  4. BIN
      playable/Assets/Prefabs/PinatatFrac 1.prefab
  5. +4
    -0
      playable/Assets/Prefabs/PinatatFrac 1.prefab.meta
  6. BIN
      playable/Assets/Prefabs/Players.prefab
  7. +4
    -0
      playable/Assets/Prefabs/Players.prefab.meta
  8. BIN
      playable/Assets/Prefabs/candy.prefab
  9. BIN
      playable/Assets/Scenes/Level2.unity
  10. +20
    -8
      playable/Assets/Scripts/CDscript.cs
  11. +45
    -0
      playable/Assets/Scripts/PlayerExplosion.cs
  12. +8
    -0
      playable/Assets/Scripts/PlayerExplosion.cs.meta
  13. +7
    -0
      playable/Assets/Scripts/collectable.cs
  14. +26
    -7
      playable/Assets/Scripts/playerController.cs
  15. BIN
      playable/ProjectSettings/InputManager.asset
  16. BIN
      playable/ProjectSettings/TimeManager.asset

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/Level2.unity View File


+ 20
- 8
playable/Assets/Scripts/CDscript.cs View File

@ -3,28 +3,40 @@ using System.Collections;
public class CDscript : MonoBehaviour { public class CDscript : MonoBehaviour {
public bool pause = false;
public bool pause = true;
public float startCount = 5.0f; public float startCount = 5.0f;
// Use this for initialization // Use this for initialization
void Start () { void Start () {
Time.timeScale = 0;
startCount -= Time.deltaTime;
pause = true; pause = true;
} }
// Update is called once per frame // Update is called once per frame
void Update () { void Update () {
if (startCount >=1.0f){
if (pause){
startCount -= Time.unscaledDeltaTime;
Time.timeScale = 0;
Debug.Log ("cd"); 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){ if (startCount <=0){
pause = false; pause = false;
}
if (pause = false){
Time.timeScale = 1; Time.timeScale = 1;
startCount = startCount + 5.0f;
} }
} }
} }

+ 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;
}
} }
} }

+ 26
- 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
@ -31,6 +32,11 @@ public class playerController : MonoBehaviour {
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
@ -48,13 +54,15 @@ public class playerController : MonoBehaviour {
private float lastDash = 0.0f; private float lastDash = 0.0f;
private bool stopDash = false; private bool stopDash = false;
public float deathTimer = 3.0f; 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 float volume = 1.0f;
private bool exploded = false;
void Start(){ void Start(){
@ -190,14 +198,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
@ -210,6 +228,7 @@ public class playerController : MonoBehaviour {
heartBlack = false; heartBlack = false;
dead = false; dead = false;
heartColor = true; heartColor = true;
exploded = false;
} }
}//end if }//end if
@ -338,7 +357,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/InputManager.asset View File


BIN
playable/ProjectSettings/TimeManager.asset View File


Loading…
Cancel
Save