Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / FSM / Conditions / EndOfTimerCondition.cs
@Rackday Rackday on 21 Aug 642 bytes Project Added
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [CreateAssetMenu(menuName = "Finite State Machine/Condition/End Timer Condition")]
  5. public class EndOfTimerCondition : Condition
  6. {
  7. [SerializeField] private string timerName;
  8. [SerializeField] private float time;
  9. protected override bool Test(FiniteStateMachine fsm)
  10. {
  11. if (fsm.floatDictionary.HasKey(timerName))
  12. {
  13. if(fsm.floatDictionary.GetValue(timerName) <= 0)
  14. {
  15. fsm.floatDictionary.SetValue(timerName, time);
  16. return true;
  17. }
  18. }
  19. return false;
  20. }
  21. }