MIF_E31222569/Assets/ToothyV/Scripts/Gameplay/State.cs

48 lines
698 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class State : MonoBehaviour
{
protected Agent Agent;
public void Initialize(Agent agent)
{
Agent = agent;
}
public void Enter()
{
Agent.AgentInput.OnAttack += HandleAttack;
EnterState();
}
protected virtual void HandleAttack()
{
}
protected virtual void EnterState()
{
}
protected virtual void ExitState()
{
}
public virtual void UpdateState()
{
}
public void Exit()
{
Agent.AgentInput.OnAttack -= HandleAttack;
ExitState();
}
}