Browse Source

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

Conflicts:
	playable/Assets/Objects/Countdown_SmackDown.fbx.meta
	playable/Assets/Objects/Countdown_SmackDown_Frac.fbx.meta
master
unknown 9 years ago
parent
commit
052af64ea8
1 changed files with 11 additions and 15 deletions
  1. +11
    -15
      playable/Assets/Scripts/playerController.cs

+ 11
- 15
playable/Assets/Scripts/playerController.cs View File

@ -19,7 +19,11 @@ public class playerController : MonoBehaviour {
public GUIText gameOverDisplay; public GUIText gameOverDisplay;
public GameObject dashDisplay; public GameObject dashDisplay;
public GameObject playerFrac; public GameObject playerFrac;
public GameObject[] hearts;
//public GameObject heart2;
//public GameObject heart3;
public float runSpeed; //run speed public float runSpeed; //run speed
public float jumpHeight; //jump height public float jumpHeight; //jump height
public float health; //holds health public float health; //holds health
@ -46,7 +50,7 @@ public class playerController : MonoBehaviour {
private float curDirection = -1; //direction player is pointing private float curDirection = -1; //direction player is pointing
private bool canJump = true; // if player can jump private bool canJump = true; // if player can jump
private bool canSpin = true; // if player can spin private bool canSpin = true; // if player can spin
private List<GameObject> hearts = new List<GameObject> (); //list which holds health sprites;
//private List<GameObject> hearts = new List<GameObject> (); //list which holds health sprites;
private bool isSpinning = false; //checks if player is spin attacking private bool isSpinning = false; //checks if player is spin attacking
private float lastHit; private float lastHit;
private float lastAttack; private float lastAttack;
@ -149,23 +153,15 @@ public class playerController : MonoBehaviour {
updateHealth = true; updateHealth = true;
if (updateHealth){ if (updateHealth){
foreach (GameObject desHeart in hearts) //Destroy all heart sprites
GameObject.Destroy (desHeart);
hearts.Clear(); //sets list to zero
foreach (GameObject heart in hearts) //Destroy all heart sprites
heart.SetActive(false); //sets list to zero
for (int i=1; i<= health; i++) { //creates new heart sprite for each health
GameObject heartCanister = Instantiate (heart) as GameObject; //creat heart sprite
Vector3 heartPos = new Vector3 ();
//set position
heartPos.x = (healthPos.x + i * 0.033f);
heartPos.y = healthPos.y;
for (int i=0; i< health; i++) { //creates new heart sprite for each health
hearts[i].SetActive(true);
heartCanister.transform.position = heartPos;
hearts.Add(heartCanister); //adds heart to list
if (heartBlack == true && heartColor == false){ if (heartBlack == true && heartColor == false){
heartCanister.guiTexture.color = Color.black;
//heartCanister.guiTexture.color = Color.black;
//else (heartCanister.guiTexture.color = Color.red); //else (heartCanister.guiTexture.color = Color.red);
} }

Loading…
Cancel
Save