void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Debug.LogError("An instance of InitiativeManager already exists!"); } order = new List <UnitController>(); }
public void Damage(UnitController uc, int damage) { int ind = units.IndexOf(uc); player.units[ind].stats["HP"] -= damage; if (player.units[ind].stats["HP"] <= 0) { SelfDestruct sd = uc.GetComponent <SelfDestruct>(); sd.Execute(3f); InitiativeManager.Exclude(uc); } }
// Update is called once per frame void Update() { if (curState == GameState.Deployment && pc.unitsDeployed && ec.unitsDeployed) { InitiativeManager.Initialize(); SwitchState(GameState.Cards); pc.UpdateControllers(); ec.UpdateControllers(); } if (curState == GameState.Ready && ec.ready) { pc.MovementPhase(); ec.MovementPhase(); ec.ready = false; SwitchState(GameState.Movement); InitiativeManager.SortOrder(); } if (curState == GameState.Movement && pc.curUnit == -1 && ec.curUnit == -1) { SwitchState(GameState.Engagement); InitiativeManager.StartCombat(); } }
/// <summary> /// Crate new empty ParticipantManager and InitiativeManager objets /// </summary> private void ResetInitiativeAndParticipants() { ParticipantManager participantManager = new ParticipantManager(); InitiativeManager initiativeManager = new InitiativeManager(); }