- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- [CreateAssetMenu(menuName = "Finite State Machine/Condition/End Timer Condition")]
- public class EndOfTimerCondition : Condition
- {
- [SerializeField] private string timerName;
- [SerializeField] private float time;
- protected override bool Test(FiniteStateMachine fsm)
- {
- if (fsm.floatDictionary.HasKey(timerName))
- {
- if(fsm.floatDictionary.GetValue(timerName) <= 0)
- {
- fsm.floatDictionary.SetValue(timerName, time);
- return true;
- }
- }
- return false;
- }
- }