Ejemplo n.º 1
0
    public void registerTowerInSpawn(byte spawn, GameTowerInstance tower)
    {
        if (_targetsBySpawn.ContainsKey(spawn))
        {
            _targetsBySpawn.Remove(spawn);
        }

        _targetsBySpawn.Add(spawn, tower);
    }
Ejemplo n.º 2
0
    public GameTowerInstance instantiateTower(string towerName, byte spawnPos)
    {
        if (_towers.ContainsKey(towerName))
        {
            GameTower gt = _towers [towerName];

            GameTowerInstance gti = new GameTowerInstance(IDFactory.getNextID(), gt, spawnPos);
            World.getInstance().registerTower(gti);

            return(gti);
        }

        return(null);
    }
Ejemplo n.º 3
0
    public override void doDie(Creature killer)
    {
        GameTowerInstance gti = killer as GameTowerInstance;

        SwarmController.getInstance().notifySoldierKilled(_spawnZoneSource, gti.getSpawn());
        LevelManager.getInstance().notifyEnemyKilled(getEnemyTemplate());

        World.getInstance().unregisterEnemy(this);

        _gameInstance.GetComponent <EnemyController> ().enabled = false;
        _gameInstance.GetComponent <HealthBarController> ().destroy();

        _gameInstance.AddComponent <AudioSource> ().loop = false;
        SoundTable.getInstance().getAudioPlayer(_gameInstance.GetComponent <AudioSource> (), "sound_enemy_death");
        _gameInstance.GetComponent <AudioSource> ().Play();
        _gameInstance.GetComponent <Animator> ().SetBool("Death", true);
        _gameInstance.AddComponent <EnemyDeathController> ();

        //GameObject.Destroy (_gameInstance);
    }
Ejemplo n.º 4
0
 public void registerTower(GameTowerInstance towerInstance)
 {
     lock (_towers) {
         _towers.Add(towerInstance.getObjectId(), towerInstance);
     }
 }
Ejemplo n.º 5
0
 public void unregisterTower(GameTowerInstance towerInstance)
 {
     lock (_towers) {
         _towers.Remove(towerInstance.getObjectId());
     }
 }