public void OnTriggerEnter(Collider other)
    {
        SheepAINoHerd shep = other.GetComponent <SheepAINoHerd>();

        if (shep != null)
        {
            if (!neighbors.Contains(other.gameObject))
            {
                neighbors.Add(other.gameObject);
                if (state != State.FLEE && Random.Range(0f, 100f) <= 15 * neighbors.Count)
                {
                    state = State.FLOCK; //Wander -> Flock
                }
            }
        }

        if (other.tag == "Scary")
        {
            if (!scaryThings.Contains(other.gameObject))
            {
                scared             = true;
                state              = State.FLEE;
                cohesionWeight     = 2f * originalCohesion;
                seperationVariance = 0.8f * originalSeperation;
                speed             *= 2f;
                if (speed > 2f * originalSpeed * barkBoostStrength)
                {
                    speed = 2f * originalSpeed * barkBoostStrength;
                }
                scaryThings.Add(other.gameObject);
            }
        }
    }
    public void OnTriggerExit(Collider other)
    {
        SheepAINoHerd shep = other.GetComponent <SheepAINoHerd>();

        if (shep != null)
        {
            if (neighbors.Contains(other.gameObject))
            {
                neighbors.Remove(other.gameObject);
                if (state != State.FLEE && Random.Range(0f, 100f) >= 20 * neighbors.Count)
                {
                    state         = State.WANDER; //Flock -> Wander
                    nextGrazeTime = Time.time + grazeBase + Random.Range(-grazeVariance, grazeVariance);
                }
            }
        }

        if (other.tag == "Scary")
        {
            if (scaryThings.Contains(other.gameObject))
            {
                scaryThings.Remove(other.gameObject);
            }
            if (scaryThings.Count <= 0)
            {
                scared      = false;
                fleeEndTime = Time.time + fleeBase + Random.Range(-fleeVariance, fleeVariance);
            }
        }
    }
    public void OnTriggerExit(Collider other)
    {
        SheepAINoHerd ai = other.GetComponent <SheepAINoHerd>();

        if (ai != null)
        {
            if (sheep.Contains(other.gameObject))
            {
                sheep.Remove(other.gameObject);
            }
        }
    }
    //Switch to a flock controller unit for better performance at a loss of agency?
    public Vector3 ComputeAlignment()
    {
        Vector3 dir   = Vector3.zero;
        int     count = 0;

        foreach (GameObject shep in neighbors)
        {
            if (CanSee(shep))
            {
                if (shep != null)
                {
                    SheepAINoHerd ai = shep.GetComponent <SheepAINoHerd>();
                    dir += ai.GetVelocity();
                    count++;
                }
            }
        }
        dir   = dir / neighbors.Count;
        dir.y = 0f;

        //Debug.Log(name + ": A ("+count+") : " + dir);

        return(dir);
    }