Example #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Debug.LogError("An instance of InitiativeManager already exists!");
     }
     order = new List <UnitController>();
 }
Example #2
0
    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);
        }
    }
Example #3
0
 // 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();
     }
 }
Example #4
0
 /// <summary>
 /// Crate new empty ParticipantManager and InitiativeManager objets
 /// </summary>
 private void ResetInitiativeAndParticipants()
 {
     ParticipantManager participantManager = new ParticipantManager();
     InitiativeManager  initiativeManager  = new InitiativeManager();
 }