예제 #1
0
    public void load_enemy_mid_fight(GameObject enemy)
    {
        int new_position  = 0;
        var loarded_enemy = Instantiate(enemy, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;

        if (enemy_spaces[0] == false)
        {
            new_position = 0;
            enemies.Insert(0, loarded_enemy.GetComponent <EnemyStats>());
            theatre.InsertEnemy(0, loarded_enemy.GetComponent <EnemyStats>());
            enemy_spaces[0] = true;
            enemy_Counter++;
        }
        else if (enemy_spaces[1] == false)
        {
            new_position = 1;
            enemies.Insert(1, loarded_enemy.GetComponent <EnemyStats>());
            theatre.InsertEnemy(1, loarded_enemy.GetComponent <EnemyStats>());
            enemy_spaces[1] = true;
            enemy_Counter++;
        }
        else if (enemy_spaces[2] == false)
        {
            new_position = 2;
            enemies.Insert(2, loarded_enemy.GetComponent <EnemyStats>());
            theatre.InsertEnemy(2, loarded_enemy.GetComponent <EnemyStats>());
            enemy_spaces[2] = true;
            enemy_Counter++;
        }
        else if (enemy_spaces[3] == false)
        {
            new_position = 3;
            enemies.Add(loarded_enemy.GetComponent <EnemyStats>());
            theatre.AddEnemy(loarded_enemy.GetComponent <EnemyStats>());
            enemy_spaces[3] = true;
        }
        loarded_enemy.GetComponent <EnemyStats>().SetPosition(new_position);
        //enemies.Add(loarded_enemy.GetComponent<EnemyStats>());
        loarded_enemy.GetComponent <CharacterAnimation>().Turn(true);
        enemyUIs[new_position].gameObject.SetActive(true);
        loarded_enemy.gameObject.transform.parent = theatre.gameObject.transform;
        loarded_enemy.transform.position          = enemy_positions[new_position].transform.position;

        loarded_enemy.GetComponent <EnemyStats>().UI = enemyUIs[new_position];
        loarded_enemy.GetComponent <EnemyStats>().Set_UI();
    }