Пример #1
0
        private void setupBattleAreas()
        {
            var battleAreasGroup = _tiledMap.getObjectGroup("battleAreas");

            if (battleAreasGroup == null)
            {
                return;
            }

            var battleAreas = battleAreasGroup.objects;

            foreach (var battleArea in battleAreas)
            {
                var battleAreaComponent = new BattleAreaComponent();
                if (battleArea.properties.ContainsKey("enemies"))
                {
                    var enemies = battleArea.properties["enemies"].Split(',');
                    battleAreaComponent.Enemies = enemies;
                }
                if (battleArea.properties.ContainsKey("waves"))
                {
                    var waves = battleArea.properties["waves"].Split(',').Select(int.Parse).ToArray();
                    battleAreaComponent.Waves = waves;
                }

                var entity = createEntity();
                entity
                .addComponent(new BoxCollider(0, 0, battleArea.width, battleArea.height))
                .addComponent(battleAreaComponent);
                entity.setPosition(battleArea.position);
            }
        }
Пример #2
0
 private void startBattle(BattleAreaComponent battleAreaComponent)
 {
     resetBattle();
     _battleHappening = true;
     _currentBattle   = battleAreaComponent;
     _currentBattle.SetActivated();
 }