Level (debug) Win Condition
This commit is contained in:
parent
6335383d45
commit
fc128cb53f
2 changed files with 16 additions and 1 deletions
|
@ -4,6 +4,7 @@ using UnityEngine;
|
|||
|
||||
public class ChargeCounter : MonoBehaviour
|
||||
{
|
||||
bool levelComplete = false;
|
||||
GameObject[] chargePoints;
|
||||
List<GameObject> chargedPoints = new List<GameObject>();
|
||||
|
||||
|
@ -24,8 +25,18 @@ public class ChargeCounter : MonoBehaviour
|
|||
DisplayCharges();
|
||||
}
|
||||
|
||||
public bool IsLevelWon()
|
||||
{
|
||||
return levelComplete;
|
||||
}
|
||||
|
||||
void DisplayCharges()
|
||||
{
|
||||
Debug.Log("Total Points:" + chargedPoints.Count);
|
||||
Debug.Log("Total Points Charged:" + chargedPoints.Count);
|
||||
if (chargedPoints.Count >= chargePoints.Length)
|
||||
{
|
||||
levelComplete = true;
|
||||
Debug.Log("Level Win!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,13 @@ public class Turret : MonoBehaviour
|
|||
|
||||
float startX;
|
||||
float startY;
|
||||
ChargeCounter chargeCounter;
|
||||
|
||||
void Start()
|
||||
{
|
||||
startX = transform.position.x;
|
||||
startY = transform.position.y;
|
||||
chargeCounter = GameObject.FindWithTag("Charge Counter").GetComponent<ChargeCounter>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
@ -40,6 +42,8 @@ public class Turret : MonoBehaviour
|
|||
|
||||
Vector3 getMovementVector()
|
||||
{
|
||||
if (chargeCounter.IsLevelWon()) return Vector3.zero;
|
||||
|
||||
float x = isHorizontal ? Input.GetAxis("Horizontal") : 0;
|
||||
float y = isHorizontal ? 0 : Input.GetAxis("Vertical");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue