public override void Reason(BleddynController bleddynController) { bool canSeePlayer = bleddynController.GetComponent <FieldOfView>().CanSeePlayer(); if (canSeePlayer) { bleddynController.SetTransition(Transition.SawPlayer); } }
public override void Reason(BleddynController bleddynController) { bool canSeePlayer = bleddynController.GetComponent <FieldOfView>().CanSeePlayer(); float distanceToPlayer = Vector3.Distance(bleddynController.transform.position, bleddynController.playerTransform.position); if (distanceToPlayer < bleddynController.bleddynConfig.attackRange) { Debug.Log("AttackPlayer"); bleddynController.SetTransition(Transition.ReachedPlayer); } if (!canSeePlayer) { bleddynController.lastKnownPlayerPosition = bleddynController.playerTransform.position; bleddynController.SetTransition(Transition.LostPlayer); } }