public override void Reason(BleddynController bleddynController) { if (bleddynController.playerInFOV()) { float distanceToPlayer = Vector3.Distance(bleddynController.playerTransform.position, bleddynController.transform.position); if (distanceToPlayer > bleddynController.bleddynConfig.attackRange) { if (!bleddynController.animator.GetCurrentAnimatorStateInfo(0).IsName("Attack") && !bleddynController.animator.IsInTransition(0)) { Debug.Log("SawPlayer"); bleddynController.SetTransition(Transition.SawPlayer); bleddynController.animator.SetBool("isAttacking", false); } } if (distanceToPlayer > bleddynController.bleddynConfig.chaseSpottingDistance) { if (!bleddynController.animator.GetCurrentAnimatorStateInfo(0).IsName("Attack") && !bleddynController.animator.IsInTransition(0)) { Debug.Log("LostPlayer"); bleddynController.SetTransition(Transition.LostPlayer); bleddynController.animator.SetBool("isAttacking", false); } } } else { Debug.Log("PlayerOutOfSight"); bleddynController.SetTransition(Transition.LostPlayer); bleddynController.animator.SetBool("isAttacking", false); } }
public override void Reason(BleddynController bleddynController) { timer -= Time.deltaTime; if (timer <= 0) { Debug.Log("GiveUpSearching"); timer = bleddynController.bleddynConfig.seekingTime; bleddynController.SetTransition(Transition.GiveUpSearching); moveToClosestPoint(bleddynController); } if (bleddynController.playerInFOV()) { if (Vector3.Distance(bleddynController.transform.position, bleddynController.playerTransform.position) <= bleddynController.bleddynConfig.seekingSpottingDistance) { Debug.Log("SawPlayer"); bleddynController.SetTransition(Transition.SawPlayer); } } }