public void HandleResource( Collider plantColl )
{
GameObject plant = plantColl.gameObject;
if ( critter.gameObject.CompareTag("Herbivore") ) // Are we a Herbivore?
{
// Debug.Log("Weve hit a Plant!" + critter.ID.ToString());
foreach ( int preyID in critter.preyList )
{
// Debug.Log("Looking for " + preyID.ToString() + " in " + plant.name);
if ( plant.name.Contains( preyID.ToString() ) )
{
if ( Random.value < .80f )
{
// Debug.Log("" + critter.ID.ToString() + " Nomm nomm " + plant.name);
critter.navMeshAgent.Stop();
Vector3 foragePoint = plantColl.ClosestPointOnBounds(critter.transform.position);
critter.navMeshAgent.SetDestination(foragePoint);
critter.navMeshAgent.Resume();
ToForageState();
}
}
}
}
}