Ejemplo n.º 1
0
    //// Private methods
    void CheckForMenaces()
    {
        List <GameObject> activeEnemies = _spawnSystem.GetActiveEnemiesGameObjects();

        foreach (GameObject enemy in activeEnemies)
        {
            EnemyBehaviour enemyBehaviour = enemy.GetComponent <EnemyBehaviour>();
            if (Vector3.Distance(this.transform.position, enemy.transform.position) <= 1.5f) // CHECK - hardcoded distance
            {
                _menaces.Add(enemyBehaviour);
            }
            else
            {
                try{
                    _menaces.Remove(enemyBehaviour);
                }catch (System.Exception) {}
            }
        }
    }