2026-01-07 12:00:57 +05:30
|
|
|
|
2026-01-07 19:38:03 +05:30
|
|
|
using UnityEngine;
|
|
|
|
|
|
2026-01-07 12:00:57 +05:30
|
|
|
public class BaseState
|
|
|
|
|
{
|
|
|
|
|
protected STAGE stage;
|
|
|
|
|
protected BaseState nextState;
|
2026-01-07 19:38:03 +05:30
|
|
|
protected Transform currentTarget;
|
|
|
|
|
protected AICarDriver aiCarDriver;
|
|
|
|
|
protected GameplayManager gameplayManager;
|
2026-01-07 12:00:57 +05:30
|
|
|
|
2026-01-07 19:38:03 +05:30
|
|
|
public BaseState(AICarDriver aiCarDriver, GameplayManager gameplayManager)
|
2026-01-07 12:00:57 +05:30
|
|
|
{
|
|
|
|
|
stage = STAGE.Enter;
|
2026-01-07 19:38:03 +05:30
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|