Time Transition interrupted and FSM resetについて

ここは、Arbor開発者へ使い方に関する質問を行うフォーラムです。
注意点:
  • ユーザー様のプロジェクトの仕様上の問題や設計に対する質問には答えられません。
  • Unityの仕様上の問題に対する質問には答えられません。

Here is the forum to do the questions about how to use to Arbor developer.
Attention point:
  • We can not answer your questions about your project specific issues.
  • We can not answer your questions on Unity's specification issues.

Forum rules
注意点:
  • ユーザー様のプロジェクトの仕様上の問題や設計に対する質問には答えられません。
  • Unityの仕様上の問題に対する質問には答えられません。

Attention point:
  • We can not answer your questions about your project specific issues.
  • We can not answer your questions on Unity's specification issues.
CHOP_JZL

Time Transition interrupted and FSM resetについて

Post by CHOP_JZL » 2019/10/15 14:05

Hello!
Today I was trying the Example 1(Basic FSM). In the Time example, if I press "back" when the cube is active, although I went back to mainmenu, the Time FSM still counting. Then when I press "Time" again, the FSM back to work from last time it stoped. So the cube will be active at the begining and become inactive immediately, which is not what I want.
Can I reset a FSM(timer, children active, etc) when get interrupted? Like the "back" button in Example 1. I tried "stop state machine", although I can restart FSM, the states data is not reseted...

User avatar
caitsithware
管理人
Posts: 307
Joined: 2015/08/17 12:41

Re: Time Transition interrupted and FSM resetについて

Post by caitsithware » 2019/10/16 00:02

Example 1 (Basic FSM) is a simple example and does not implement complex reset processing.

To implement reset, it is better to implement reset state by combining SendTrigger, TriggerTransition, PlayStateMachine, StopStateMachine.

For example, the following FSM.

MainMenu
Example_FSMReset_Time.png
Example_FSMReset_Time.png (124.62 KiB) Viewed 89 times
Open

Time
Example_FSMReset_Time.png
Example_FSMReset_Time.png (124.62 KiB) Viewed 88 times
Open

Main flow
  1. MainMenu FSM : In the Time state, activate the Time object and play the TimeFSM.
  2. MainMenu FSM : When the Back button is pressed, a "Reset" trigger message is sent to TimeFSM in the ResetTimeFSM state.
  3. Time FSM : Accept the "Reset" trigger with ResetTrigger in the resident state, and immediately transition to the Reset state.
  4. Time FSM : Performs reset processing in the Reset state and immediately transitions to the End state.
  5. Time FSM : Send "End" trigger to MainMenu FSM in End state.
  6. MainMenu FSM : Reset TimeFSM accepts "End" trigger and immediately transitions to EndTimeFSM state.
  7. MainMenu FSM : Stop Time FSM and deactivate Time object in EndTimeFSM state. Transition to MainMenu state.
By using graph hierarchies (SubStateMachine, EndStateMachine), you can build the best graph.
See Example 14 (Graph Hierarchy) for more information on graph hierarchy.
Attachments
Example_FSMReset_Time.png
Example_FSMReset_Time.png (124.62 KiB) Viewed 88 times
Example_FSMReset_MainMenu.png
Example_FSMReset_MainMenu.png (136.98 KiB) Viewed 89 times

CHOP_JZL

Re: Time Transition interrupted and FSM resetについて

Post by CHOP_JZL » 2019/10/16 01:28

Hello!
Thank you for the answer. After I reproduce it myself, I noticed I made a big mistake. I used "stop state machine" after the Time gameobject is inactived, that's why the FSM didn't stop...In the mainmenu graph of your answer, I tried to just link "Time" node and "End TimeFSM" node, it still words, and the TimeFSM reseted properly. So the FSM actually can reset it self if it's active , my mistake...

Post Reply