- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using MyCollections.AI.FinitStateMachine;
- [CreateAssetMenu(menuName = "Finite State Machine/Condition/CanAttack")]
- public class CanAttack : Condition
- {
- [SerializeField] private float distance;
- public override bool CheckCondition(FSM fsm)
- {
- if (fsm.Controller.AgentFOV.GetTarget() != null)
- {
- OrcNPCController npcController = fsm.Controller as OrcNPCController;
- if(npcController != null)
- {
-
- return fsm.Controller.AgentFOV.TargetDistance <= distance && npcController.AttackTimer >= npcController.MaxAttackTimer;
- }
- Debug.LogError("Controller is null");
- return false;
- }
- return false;
- }
- }