Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / Navmesh / Conditions / LookAroundCondition.cs
@Rackday Rackday on 21 Aug 519 bytes Project Added
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [CreateAssetMenu(menuName ="Finite State Machine/Condition/Look Around")]
  5. public class LookAroundCondition : Condition
  6. {
  7. protected override bool Test(FiniteStateMachine fsm)
  8. {
  9. ILookAround stalker = fsm.GetComponentInChildren<ILookAround>();
  10. if (stalker != null)
  11. {
  12. return stalker.isObserving == fsm.target.gameObject;
  13. } else
  14. {
  15. return false;
  16. }
  17. }
  18. }