Hey there!
So I'm working with the cool Time Control and Pausekit in order to pause my game without TimeScale. It works pretty well. The only thing is: some certain fsms are still running, like the AI.
My AI is driven with the 2D Platform Controller-Plugin AND PlayMaker. The thing is I'm telling the AI via PlayMaker how exactly it should move. I made a simple EnemyInput-Script with certain functions like:
void MoveRight()
{
x = (0.5f*speed)*timeController.ControllerSpeedZeroToOne;
moveDirection = 1;
}
/// <summary>
/// Moves to Left
/// </summary>
void MoveLeft()
{
x = -0.5f*speed*timeController.ControllerSpeedZeroToOne;
moveDirection = -1;
}
I use the "Invoke Method"-action and call these methods. For example, the Patrol-State:
- MoveRight is called
-> AI walks to right
- Wait-Action for 1-2 seconds (Invoke also Method to stop movement!)
- MoveLeft is called
-> AI walks to left
and so on
When I pause the game, the AI stands still, but the state-machine is still working and changes it's states.
Is there a way to Pause the entire FSM in the certain state and when resumed it starts working again at that state?