Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / FSM / Conditions / EndOfTimerCondition.cs
@Rackday Rackday on 21 Aug 642 bytes Project Added
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;
    }
}