Ejemplo n.º 1
0
 public void PerformAction()
 {
     attackersIndex = 0;
     defendersIndex = 0;
     if (this.currentPhase == testPhase.SETUP)
     {
         this.currentPhase = testPhase.TEST;
         this.model.RemoveEmptyGroups();
         this.UpdateUnitGroupViews();
     }
     if (this.currentPhase == testPhase.TEST)
     {
         if (attackViews.Count == 0 && model.GenerateAttackRollResults())
         {
             UpdateAttackRollAttackResultObjects();
         }
     }
 }
Ejemplo n.º 2
0
    public void ResetModel()
    {
        currentPhase = testPhase.SETUP;
        actionButton.GetComponentInChildren<Text>().text = "Start";
        this.SetTestReadiness(false);

        attackersIndex = 0;
        defendersIndex = 0;

        model = new Combat();
        model.PhaseChanged += OnCombatPhaseChanged;
        List<UnitGroup> attackers = new List<UnitGroup>();
        List<UnitGroup> defenders = new List<UnitGroup>();
        string[] unitTypeNames = UnitType.GetAllUnitTypeNames();

        for (int i = 0; i < unitTypeNames.Length; i++)
        {
            UnitType type = UnitType.GetUnitType(unitTypeNames[i]);
            if (type != null)
            {
                attackers.Add(new UnitGroup(type, 0));
                defenders.Add(new UnitGroup(type, 0));
            }
        }

        model.SetupGroups(attackers, defenders);
        DestroyAttackRollAttackResultObjects();
        UpdateUnitGroupViews();
    }