Beispiel #1
0
    virtual protected Enemy selectTarget()
    {
        Enemy retour = null;

        float             distance  = range;
        List <GameObject> listEnemy = poolingEnemy.getListActive();

        foreach (GameObject gO in listEnemy)
        {
            if (!gO.GetComponent <Enemy> ().isDead())
            {
                if (Vector3.Distance(gO.transform.position, this.transform.position) <= distance)
                {
                    retour   = gO.GetComponent <Enemy> ();
                    distance = Vector3.Distance(gO.transform.position, this.transform.position);
                }
            }
        }

        return(retour);
    }