Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / FSM / Actions / Investigate.cs
@Rackday Rackday on 21 Aug 774 bytes Project Added
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [CreateAssetMenu(menuName = "Finite State Machine/Action/Investigate")]
  5. public class Investigate : Action
  6. {
  7. [SerializeField] private string timerName;
  8. [SerializeField] private float time;
  9. public override void Act(FiniteStateMachine fsm)
  10. {
  11. if (!fsm.floatDictionary.HasKey(timerName)) fsm.floatDictionary.SetValue(timerName, time);
  12. if (fsm.GetAgent().IsAtDestination())
  13. {
  14. Debug.Log(fsm.animationController.animator);
  15. fsm.floatDictionary.SetValue(timerName, fsm.floatDictionary.GetValue(timerName) - Time.deltaTime);
  16. fsm.animationController.animator.SetBool("Idle", true);
  17. }
  18. }
  19. }