Ashby Issac c466e28d6c AI FSM changes.
- Protoyped on the AI movement, found solutions for turns and
   moving after impacting the player.
- Created a full base for AI state machine.
- Worked on binding the core AI logic with the finite state machine.
2026-01-07 19:38:03 +05:30

37 lines
887 B
C#

using UnityEngine;
public class BaseState
{
protected STAGE stage;
protected BaseState nextState;
protected Transform currentTarget;
protected AICarDriver aiCarDriver;
protected GameplayManager gameplayManager;
public BaseState(AICarDriver aiCarDriver, GameplayManager gameplayManager)
{
stage = STAGE.Enter;
this.aiCarDriver = aiCarDriver;
this.gameplayManager = gameplayManager;
}
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;
}
}