コード例 #1
0
        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;
            }
        }