private void Awake() { //Make sure Coordinates are initialized early so that they can be referenced by managers in their start functions UpdateCoordinatesWithTransformPosition(); //Assign team based on gameobject tag switch (tag) { case "Red Team": Team = TurnManager.TeamColor.Red; break; case "Blue Team": Team = TurnManager.TeamColor.Blue; break; case "Green Team": Team = TurnManager.TeamColor.Green; break; case "Yellow Team": Team = TurnManager.TeamColor.Yellow; break; default: print("Error: " + gameObject.name + " is not assigned to a team. Object Will Be Destroyed."); break; } //Subscribe to Turn Events TurnManager tMan = FindObjectOfType <TurnManager>(); tMan.PhaseStart += OnPhaseStart; tMan.PhaseEnd += OnPhaseEnd; }
private void OnPhaseStartLate(TurnManager.TeamColor CurrentTeam, int TurnCount) { if (CurrentTeam == TurnManager.TeamColor.Red) { //set the rest of the units to waiting to trigger turn swap. Do this late to get around units setting themselves active EndTurn(tMan.Team[(int)CurrentTeam]); } }
private void OnPhaseEnd(TurnManager.TeamColor CurrentTeam, int TurnCount) { if (CurrentTeam == TurnManager.TeamColor.Red) { UnitList.Clear(); //Delete Seed Here } }
private void OnPhaseStart(TurnManager.TeamColor CurrentTeam, int TurnCount) { //If it is the enemy phase, do some stuff if (CurrentTeam == TurnManager.TeamColor.Red) { //set list and actions UnitList = tMan.Team[(int)CurrentTeam]; Actions = UnitList.Count; //create and save seed here //sort and cull unit list here //loop through list and run state machine on each unit for (int i = 0; i < Actions; i++) { FSM(UnitList[i]); } } }
protected virtual void OnPhaseEnd(TurnManager.TeamColor CurrentTeamTurn, int TurnCount) { }
//Characters will update first, that way components (like injuries) can override and modify behaviour. protected virtual void OnPhaseStart(TurnManager.TeamColor CurrentTeamTurn, int TurnCount) { CurrentState = _State.Idle; }
void sample(TurnManager.TeamColor team, int Turn) { } //print(team + " is blue and the current turn"); }