I am trying to set up a turn based game where I move my team then the computer moves theirs, and I want to detect when all of them are done moving so that I can switch the turn over. I have this in all of the scripts I want to check.
public class PlayerScript : MonoBehaviour
public bool
HasNoMovement;
public float
RemainingMovement;
void Update()
{
if (RemainingMovement == 0)
HasNoMovement = true;
}
From here on out is where everything kinda falls apart for me, on another script I have
public class TurnManagerScript : Monobehaviour{
private bool
PlayerTurn;
private GameObject[]
Players;
private int
PlayerNumber;
void Update()
{
if (Players[PlayerNumber].GetComponent<PlayerScript>().HasNoMovement == true)
PlayerNumber++;
if (PlayerNumber > Players.Length)
EndingThePlayerTurn();
}
}
which doesn’t work, and will not fire the EndingThePlayerTurn method. So my question is how do I get this second code to work?