Newer
Older
TheVengeance-Project-IADE-Unity2D / Assets / Scripts / NPC / Orc / Actions / SetIdleTime.cs
@Rackday Rackday on 3 Sep 600 bytes Minor Update
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MyCollections.AI.FinitStateMachine;

[CreateAssetMenu(menuName = "Finite State Machine/Action/SetIdleTime")]
public class SetIdleTime : Action
{
    public override void Run(FSM fsm)
    {
        IdleState state = (IdleState)fsm.CurrentState();
        Agent agent = fsm.Controller.Agent;
        state.generated = false;

        agent.agentStop = true;

        if (state != null)
        {
            state.timer = Random.Range(2f, 10f);
            Debug.Log($"TIMER IDLE: {state.timer}f");
        }
    }
}