public void Execute() { if (foodTarget != null) { Debug.DrawLine(owner.transform.position, foodTarget.position, Color.red); } else { if (boidActor.GetFoodType() == "Bird") { Debug.Log("Coyote has no food"); } } //find food target if none already if ((foodTarget == null) && (owner.targetPosition == null)) { findFood(); } if (Random.Range(1, 100) == 1) { findFood(); } Vector3 targetPos; if (foodTarget != null) { targetPos = foodTarget.position; } else { targetPos = owner.targetPosition; } if (Vector3.Distance(owner.transform.position, targetPos) < 1) { //consume food target if next to it boidActor.TryAttack(); } else { Debug.Log($"searching for {boidActor.GetFoodType()}"); owner.MoveBoid(); } }
public void Enter() { owner.target = owner.flockTarget; Debug.Log("enter flock state"); if (boidActor.GetFoodType() == "Bird") { Debug.Log("coyote doin stupid shit"); owner.switchState(new GrazeState(owner, boidActor)); } }