Exemplo n.º 1
0
    void FindPlayer()
    {
        if (!foundPlayer)
        {
            Collider2D[] colliders = Physics2D.OverlapAreaAll(new Vector2(transform.position.x - 20f, transform.position.y + 5f),
                                                              new Vector2(transform.position.x + 20f, transform.position.y - 5f));

            int lenght = colliders.Length;

            for (int i = 0; i < lenght; i++)
            {
                if (colliders[i].gameObject.CompareTag("AchillesBody"))
                {
                    player      = colliders[i].gameObject;
                    foundPlayer = true;
                    this.transform.GetChild(0).gameObject.SetActive(true);
                    ic = transform.GetChild(0).GetComponent <BrigandController>();
                    ic.SetPlayer(player);
                    this.transform.GetChild(0).gameObject.transform.parent = null;
                    Destroy(this.gameObject);
                }
            }
        }
    }