public override void PerformCommand()
        {
            SpawnablesManager manager = Object.FindObjectOfType <SpawnablesManager>();

            Assert.IsNotNull(manager);
            Assert.IsNotNull(troopToSpawn);

            CellBehaviour spawnLocation = GetRandomFreeCell();

            switch (troopToSpawn)
            {
            case ENTITY.Launcher:
                manager.SpawnEntity(spawnLocation, troopToSpawn, Entity.Owner.AI);
                break;

            case ENTITY.Prisioner:
                manager.SpawnEntity(spawnLocation, troopToSpawn, Entity.Owner.AI);
                break;

            case ENTITY.Tank:
                manager.SpawnEntity(spawnLocation, troopToSpawn, Entity.Owner.AI);
                break;

            case ENTITY.Turret:
                manager.SpawnEntity(spawnLocation, troopToSpawn, Entity.Owner.AI);
                break;

            case ENTITY.Wall:
                manager.SpawnEntity(spawnLocation, troopToSpawn, Entity.Owner.AI);
                break;
            }
        }
Beispiel #2
0
 private void SpawnIfPossibleInCell()
 {
     if (_turnHandler.currentTurn == PlayerType.Player &&
         hit.collider.GetComponent <CellBehaviour>().GetOwner() == PlayerType.Player &&
         Input.GetMouseButtonDown(0) &&
         lastCellSelected.GetEntityIn() == null &&
         _levelController.CheckIfCanSpawn(Entity.Owner.Player) && hit.collider.GetComponent <CellBehaviour>().GetComponent <SpawnableCell>() != null)      //ningun NPC nuestro spawneado esta en estado ataque o move
     {
         _spawnablesManager.SpawnEntity(hit.collider.GetComponent <CellBehaviour>(), _spawnablesManager.currentEntitySelected, Entity.Owner.Player);
         _levelController.DisableSpawnableCellsShader();
     }
 }