Added Swigs left gui text.

This commit is contained in:
shakurass 2014-04-26 20:59:09 -06:00
commit d4a6d0bb00
10 changed files with 153 additions and 128 deletions

View file

@ -11,22 +11,30 @@ public class PlayerController : MonoBehaviour {
public Transform shankSpawn;
public GameObject vvAura;
public int swigCounter;
private int swigs = 0;
private GameController gameController;
void Start() {
GameObject gameControllerObject = GameObject.FindWithTag("GameController");
if (gameControllerObject != null)
gameController = gameControllerObject.GetComponent <GameController> ();
else
Debug.Log("Cannot find GameController script.");
}
void Update()
{
if (Input.GetButton("Fire1") && Time.time > nextFire)
{
//audio.Play ();
nextFire = Time.time + delay;
Instantiate(shank, shankSpawn.position, playerAngle.rotation);
}
if (Input.GetButton("ActivateVV") && swigs < swigCounter && Time.time > nextFire)
if (Input.GetButton("ActivateVV") && gameController.swigs > 0 && Time.time > nextFire)
{
nextFire = Time.time + delay * 2;
Instantiate (vvAura, rigidbody.position, rigidbody.rotation);
swigs++;
gameController.TakeSwig();
}
}
@ -36,11 +44,11 @@ public class PlayerController : MonoBehaviour {
if (moveHorizontal < 0)
playerAngle.eulerAngles = new Vector3(0f, -180f, 0f);
else if (moveHorizontal > 0)
if (moveHorizontal > 0)
playerAngle.eulerAngles = new Vector3(0f, 0f, 0f);
else if (moveVertical < 0)
if (moveVertical < 0)
playerAngle.eulerAngles = new Vector3(0f, -270f, 0f);
else if (moveVertical > 0)
if (moveVertical > 0)
playerAngle.eulerAngles = new Vector3(0f, -90f, 0f);
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);