Exemple #1
0
    void detect_first_enemy()
    {
        float?min_x = null;

        numb_enemies = 0;
        for (int i = 0; i < transform.childCount; i++)
        {
            Transform   Go = transform.GetChild(i);
            enemyObject _current_enemie = Go.GetComponent <enemyObject>();
            if (!_current_enemie.is_alive)
            {
                continue;
            }
            numb_enemies++;
            if (min_x == null)
            {
                min_x = Go.transform.position.x;
                update_enemy_ahead(_current_enemie);
            }
            else
            {
                if (min_x > Go.transform.position.x)
                {
                    min_x = Go.transform.position.x;
                    update_enemy_ahead(_current_enemie);
                }
            }
        }
    }
 public void change_first_enemy(enemyObject _first_enemy)
 {
     first_enemy = _first_enemy;
     player_sprite.change_target_pos(first_enemy.transform.position);
 }
Exemple #3
0
 public void change_enemy_ahead(enemyObject _i)
 {
     enemy_ahead = _i;
     player_director.change_first_enemy(enemy_ahead);
 }
Exemple #4
0
 private void update_enemy_ahead(enemyObject i)
 {
     enemy_ahead = i;
     the_director.change_enemy_ahead(enemy_ahead);
 }