using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; [CreateAssetMenu(menuName = "Finite State Machine/Condition/TryToFindCoverLocation")] public class TryToFindCoverLocation : Condition { [SerializeField] private CheckTargetState targetState; [SerializeField] private string tag; public override bool CheckCondition(FSM fsm) { if (targetState.CheckCondition(fsm)) { return FindCover(fsm); } else return false; } private bool FindCover(FSM fsm) { Awareness agentAware = fsm.Controller.AgentAwareness; if (agentAware != null) { agentAware.SetTargetTag(tag); agentAware.enabled = true; return agentAware.TargetsList.Count > 0; } else return false; } }