private void Awake()
        {
            var builder = new BattleUnitBuilder();

            var allyUnit1 = builder.Create(_unitsController.GetUnit("unit_trooper_attack"));

            allyUnit1.Team  = BattleUnitTeamType.Ally;
            allyUnit1.Place = 2;
            var allyUnit2 = builder.Create(_unitsController.GetUnit("unit_support_attack"));

            allyUnit2.Team  = BattleUnitTeamType.Ally;
            allyUnit2.Place = 3;

            var enemyUnit1 = builder.Create(_unitsController.GetUnit("unit_trooper_defense"));

            enemyUnit1.Team  = BattleUnitTeamType.Enemy;
            enemyUnit1.Place = 2;
            var enemyUnit2 = builder.Create(_unitsController.GetUnit("unit_support_defense"));

            enemyUnit2.Team  = BattleUnitTeamType.Enemy;
            enemyUnit2.Place = 3;

            _battleController.UnitsList.Add(allyUnit1);
            _battleController.UnitsList.Add(allyUnit2);
            _battleController.UnitsList.Add(enemyUnit1);
            _battleController.UnitsList.Add(enemyUnit2);
        }
示例#2
0
        protected override void Click()
        {
            base.Click();

            var builder   = new BattleUnitBuilder();
            var allyUnits = _partyMenuController.Battle.AllyUnits
                            .Where(x => x.Unit != null);

            foreach (var ally in allyUnits)
            {
                var unit     = _unitsController.GetUnit(ally.Unit.Key);
                var allyUnit = builder.Create(unit);
                allyUnit.Team  = BattleUnitTeamType.Ally;
                allyUnit.Place = ally.transform.GetSiblingIndex() + 1;

                _battleMenuController.UnitsList.Add(allyUnit);
            }

            var enemyUnits = _partyMenuController.Battle.EnemyUnits
                             .Where(x => x.Unit != null);

            foreach (var enemy in enemyUnits)
            {
                var unit      = _unitsController.GetUnit(enemy.Unit.Key);
                var enemyUnit = builder.Create(unit);
                enemyUnit.Team  = BattleUnitTeamType.Enemy;
                enemyUnit.Place = enemy.transform.GetSiblingIndex() + 1;

                _battleMenuController.UnitsList.Add(enemyUnit);
            }

            _battleMenuFactory.Create();
            Destroy(_partyMenuController.Menu.gameObject, 0.05f);
        }