Пример #1
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);
    }
Пример #2
0
    public static GameTargetInstance instantiate()
    {
        int objectId = IDFactory.getNextID();

        if (_templateObject == null)
        {
            StatsSet set = new StatsSet();
            set.set("name", "Castillo");
            set.set("relativeModelPath", "Target_Castle/target_castle");
            set.set("health", 2500.0f);
            _templateObject = new GameTarget(set);
        }

        GameTargetInstance gti = new GameTargetInstance(objectId, _templateObject);

        World.getInstance().registerTarget(gti);

        return(gti);
    }
Пример #3
0
    public GameEnemyInstance spawnSoldier(string attackerTemplate, int spawnZone, byte order)
    {
        SwarmOrder orderObj = createOrder(0, order, spawnZone);

        GameEnemy template = EnemyTable.getInstance().getEnemyByName(attackerTemplate);

        if (template == null)
        {
            return(null);
        }

        GameEnemyInstance attacker = new GameEnemyInstance(IDFactory.getNextID(), template, spawnZone);

        World.getInstance().registerEnemy(attacker);

        Vector3 spawnPosition = _positions [_computedPaths [spawnZone].getSpawnPointIndex()];

        attacker.getGameInstance().transform.position = spawnPosition;

        attacker.getGameInstance().GetComponent <EnemyController> ().setOrder(orderObj);

        return(attacker);
    }