Пример #1
0
    void CreateEnemy(Enemy.types type)
    {
        Enemy newEnemy;

        switch (type)
        {
        case Enemy.types.SMALL:
            newEnemy = Instantiate(enemy1);
            break;

        case Enemy.types.MEDIUM:
            newEnemy = Instantiate(enemy2);
            break;

        default:
            newEnemy = Instantiate(enemy3);
            break;
        }
        Vector3 pos = startingPath.position;

        newEnemy.transform.SetParent(World.Instance.world.transform);
        newEnemy.transform.position = pos;
        newEnemy.SetMoveToTarget(firstNode.transform);
        newEnemy.Init(type);
    }
Пример #2
0
    void AddWave(JSONNode content)
    {
        print(content);
        for (int a = 0; a < content.Count; a++)
        {
            List <Enemy.types> enemies = new List <Enemy.types> ();
            for (int b = 0; b < content [a] ["enemies"].Count; b++)
            {
                Enemy.types type = Enemy.types.MEDIUM;
                switch (content [a] ["enemies"][b])
                {
                case "0":
                    type = Enemy.types.MEDIUM;
                    break;

                case "1":
                    type = Enemy.types.SMALL;
                    break;

                case "2":
                    type = Enemy.types.BIG;
                    break;
                }
                enemies.Add(type);
                print("________" + content [a] ["enemies"] [b] + " type: " + type);
            }
            int delay = int.Parse(content [a] ["delay"]);
            waves.AddWave(enemies, delay);
        }
    }
Пример #3
0
    public Character GetEnemyByType(Enemy.types types)
    {
        switch (types)
        {
        case Enemy.types.SMALL:
            return(enemiesSmall);

        case Enemy.types.MEDIUM:
            return(enemiesMedium);

        default:
            return(enemiesBig);
        }
    }
Пример #4
0
    void LoopSpawn()
    {
        Enemy.types enemyType = actualWave.enemies [enemiesSpawnedID];
        enemiesSpawnedID++;

        CreateEnemy(enemyType);
        if (enemiesSpawnedID < total)
        {
            Invoke("LoopSpawn", time_to_spawn);
        }
        else
        {
            Respawn();
        }
    }