Ejemplo n.º 1
0
        public void spawnActors()
        {
            List <TeamSlot> teamSlots = _characterBattleGetter.getCharacters();

            foreach (TeamSlot teamSlot in teamSlots)
            {
                BattleSpawningPoint battleSpawningPoint = _characterSpawningPoints.Find(x => x.position == teamSlot.battlePosition && x.isFrontSpawn == teamSlot.frontPosition);
                battleSpawningPoint.actor           = teamSlot.character;
                battleSpawningPoint.actorGameObject = GameObject.Instantiate(teamSlot.character.model, battleSpawningPoint.transform);
            }

            List <Enemy> enemies = _enemyGetter.getEnemies();

            foreach (Enemy enemy in enemies)
            {
                List <BattleSpawningPoint> spawnPointAvailable = _enemySpawningPoints.FindAll(x => x.actor == null);

                if (spawnPointAvailable == null || spawnPointAvailable.Count == 0)
                {
                    return;
                }

                BattleSpawningPoint battleSpawningPoint = spawnPointAvailable.getRandomElement();
                battleSpawningPoint.actor           = enemy;
                battleSpawningPoint.actorGameObject = GameObject.Instantiate(enemy.model, battleSpawningPoint.transform);
            }
        }
Ejemplo n.º 2
0
 /// <summary> Generate a List of target  </summary>
 /// <param name="spawningPoint"></param>
 /// <returns></returns>
 public BattleTarget(BattleSpawningPoint spawningPoint)
 {
     button = spawningPoint.GetComponentInChildren <MenuButton>();
     model  = spawningPoint.actorGameObject;
     actor  = spawningPoint.actor;
 }