2 using System.Collections.Generic;
16 [Tooltip(
"Should the order of execution of the events be random? If false, the order will be the same as in the events array.")]
25 [Tooltip(
"Each of the events to execute at every call of the Invoke method.")]
26 [SerializeField]
public UnityEvent[]
events;
30 [NonSerialized]
private UnityEvent
nextEvent =
null;
38 List<UnityEvent>
events =
new List<UnityEvent>();
40 foreach (UnityAction unityAction
in actions)
42 UnityEvent unityEvent =
new UnityEvent();
43 unityEvent.AddListener(unityAction);
47 this.events =
events.ToArray();
50 if (randomizationSeed == -1)
61 if (randomizationSeed == -1)
Allows you to execute different events every time the Invoke method of this is class called.
UnityEvent[] events
Each of the events to execute at every call of the Invoke method.
int nextEventIndex
The index of the next UnityEvent to be executed.
RandomEssentials random
The randomness generation object to choose the next event to execute.
bool randomizeOrder
Should the order of execution of the events be random? If false, the order will be the same as in the...
Sequence(UnityEvent[] events, bool randomizeOrder=false, int randomizationSeed=-1)
UnityEvent nextEvent
The next UnityEvent to be executed. If null, firstEvent is going to be executed next .
Sequence(UnityAction[] actions, bool randomizeOrder=false, int randomizationSeed=-1)
An easier to use and a feature-rich class to generate pseudo-random results.