Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / FSM / Actions / Investigate.cs
@Rackday Rackday on 21 Aug 774 bytes Project Added
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Finite State Machine/Action/Investigate")]
public class Investigate : Action
{
    [SerializeField] private string timerName;
    [SerializeField] private float time;
    public override void Act(FiniteStateMachine fsm)
    {
       
        if (!fsm.floatDictionary.HasKey(timerName)) fsm.floatDictionary.SetValue(timerName, time);
        
        if (fsm.GetAgent().IsAtDestination())
        {
            Debug.Log(fsm.animationController.animator);
            fsm.floatDictionary.SetValue(timerName, fsm.floatDictionary.GetValue(timerName) - Time.deltaTime);
            
            fsm.animationController.animator.SetBool("Idle", true);

        }
    }
}