37 lines
887 B
C#
Raw Normal View History

2026-01-07 12:00:57 +05:30
using UnityEngine;
2026-01-07 12:00:57 +05:30
public class BaseState
{
protected STAGE stage;
protected BaseState nextState;
protected Transform currentTarget;
protected AICarDriver aiCarDriver;
protected GameplayManager gameplayManager;
2026-01-07 12:00:57 +05:30
public BaseState(AICarDriver aiCarDriver, GameplayManager gameplayManager)
2026-01-07 12:00:57 +05:30
{
stage = STAGE.Enter;
this.aiCarDriver = aiCarDriver;
this.gameplayManager = gameplayManager;
2026-01-07 12:00:57 +05:30
}
protected virtual void Enter() => stage = STAGE.Update;
protected virtual void Update() => stage = STAGE.Update;
protected virtual void Exit() => stage = STAGE.Exit;
public BaseState ProcessStates()
{
if (stage == STAGE.Enter) Enter();
if (stage == STAGE.Update) Update();
if (stage == STAGE.Exit)
{
Exit();
return nextState;
}
return this;
}
}