Hi again,
I have been researching ways to create an FSM for resource collection, as my knowledge of C# is limited I’m searching for a goldilocks version (not too hard to understand at my current level of knowledge but efficient enough for it not to become a tangled mess.
I have come across FlexFSM which looks simple enough for me to get stuck into and edit however I’m having some problems figuring out how to add a pause when entering or exiting states.
Please don’t laugh
I tried adding the following to the bottom of the Miner.cs;
public void StartPause() {
StartCoroutine(TestPause());
}
public IEnumerator TestPause(){
yield return new WaitForSeconds(3f);
}
And adjusted in MinerStates.cs;
public override void OnEnter(GameObject owner)
{
miner.LogAction("Entering mine");
miner.StartPause();
}
To try and force a 3 second pause, this obviously did not work when loops become nested I have difficulty following actions through them. maybe that will just come with time.
I’m guessing I would need to adjust the following in Miner.cs to allow for pauses but, need some guidance if you have the time.
void Update()
{
if (fsm != null && fsm.IsActive())
{
fsm.UpdateFSM();
currentState = fsm.GetCurrentStateName();
}
}