Exemplo n.º 1
0
    void CheckForValidAddBirdCollision(Collider2D other)
    {
        FlockAgent agent = other.GetComponentInParent <FlockAgent>();

        // If a flock agent runs into this trigger, add all the birds in this flock to that flock
        if (agent != null && !flockManager.InFlock(agent))
        {
            FlockManager otherFlock = agent.transform.root.GetComponent <FlockManager>();
            if (otherFlock != null)
            {
                otherFlock.AddBirdsFromFlock(flockManager, flockManager.GetNumberOfAgents());
                Destroy(gameObject);
            }
        }
    }