Hi,
is there a way to cancel a sequence? I had this sequence where the camera paned over a landscape and when it has arrived at its destination it should load the next level.
Fade(in, 2); MoveTo(CWaypoint00, Main Camera, 30); MoveTo(CWaypoint01, Main Camera, 5)@30;
Fade(in, 2); MoveTo(CWaypoint00, Main Camera, 30); MoveTo(CWaypoint01, Main Camera, 5)@30; Fade(out,3)@35; LoadLevel(00_white_forest_village_dream_Intro)@36;
So nothing special. I gave the player to cancel this via a simple button press. So lets's say I watch the sequence for 10 seconds and then press the button. Then the level gets loaded but the sequence keeps running in the background and 26 seconds later it executes the command (LoadLevel(00_white_forest_village_dream_Intro)@36;) and reloads the level.
so long story short, is there a way to cancel a sequence in a way that the not yet executed commands will not be executed later?
Thanks for your support
Cancel Sequence?
Re: Cancel Sequence?
Hi,
Use this code to stop the sequence:
If you manually started a sequence using DialogueManager.PlaySequence(), it returned a Sequencer object. You can pass that object to StopSequence instead:
If any of your sequencer commands start with the "required" keyword, when you call StopSequence() they will play immediately:
Since there's a "required" in front of LoadLevel, it's guaranteed to play even if you stop the sequence early.
Use this code to stop the sequence:
Code: Select all
DialogueManager.StopSequence(DialogueManager.Instance.GetComponent<Sequencer>());
Code: Select all
var sequencer = DialogueManager.PlaySequence(mySequence);
...
DialogueManager.StopSequence(sequencer);
Code: Select all
Fade(in, 2); MoveTo(CWaypoint00, Main Camera, 30); MoveTo(CWaypoint01, Main Camera, 5)@30; Fade(out,3)@35;
required LoadLevel(00_white_forest_village_dream_Intro)@36;