private void OnUpdatePlaying_OneAtATime(TriggeredBehaviour nextIncomplete) { //TODO: This method and the area that calls it needs some revision. //if (sequenceType == SequenceType.OneAtATime_AutomaticPlayReady && nextIncomplete.IsReady) // nextIncomplete.RequestPlaying (); if (sequenceType == SequenceType.OneAtATime) { return; } if (nextIncomplete.IsPlaying) { return; } if (nextIncomplete.IsReady) { nextIncomplete.RequestPlaying(_lastTriggerer); } /*for (int i = 0; i < _behaviours.Count; i++) * { * if (_behaviours[i].IsPlaying) * break; * if (_behaviours[i].IsReady) * { * _behaviours[i].RequestPlaying (); * break; * } * }*/ }
private void OnUpdatePlaying_Simultaneous(TriggeredBehaviour nextIncomplete) { if (nextIncomplete.IsReady && nextIncomplete.CurPlaysRequested >= 0) { RequestComplete(); } }
/// <summary> /// Called every frame behaviour is in the Playing state. /// For over-time behaviours, this is where most of the logic will go. /// </summary> protected override void OnUpdatePlaying() { TriggeredBehaviour nextIncomplete = GetNextIncompleteBehaviour(); if (nextIncomplete == null) { RequestComplete(); return; } switch (sequenceType) { case SequenceType.Simultaneous: OnUpdatePlaying_Simultaneous(nextIncomplete); break; case SequenceType.RapidInOrder: OnUpdatePlaying_RapidInOrder(nextIncomplete); break; case SequenceType.OneAtATime: case SequenceType.OneAtATime_AutomaticPlayReady: OnUpdatePlaying_OneAtATime(nextIncomplete); break; } }
private TriggeredBehaviour DrawBehaviourField(int index) { Transform curTransform = behaviourTransforms[index]; TriggeredBehaviour curBehaviour = null; if (curTransform != null) { curBehaviour = curTransform.GetComponent <TriggeredBehaviour> () as TriggeredBehaviour; } TriggeredBehaviour newBehaviour = EditorGUILayout.ObjectField ("Behaviour", curBehaviour, typeof(TriggeredBehaviour), true) as TriggeredBehaviour; if (newBehaviour == null) { behaviourTransforms[index] = null; } else { behaviourTransforms[index] = newBehaviour.transform; } return(newBehaviour); }
private void DrawTriggeredBehaviourEntry(int index) { TriggeredBehaviour behaviour = DrawBehaviourField(index); if (behaviour == null) { return; } behaviour.DrawInspector(); }
/// <summary> /// Called by parent class at the end of its AteAwake(). /// </summary> protected override void OnAwake() { // Populate _behaviours so we don't have to use GetComponent all the time _behaviours = new List <TriggeredBehaviour> (); for (int i = 0; i < behaviourTransforms.Count; i++) { if (behaviourTransforms[i] == null) { continue; } TriggeredBehaviour behaviour = behaviourTransforms[i].GetComponent <TriggeredBehaviour> () as TriggeredBehaviour; if (behaviour != null) { _behaviours.Add(behaviour); } } }
private void OnUpdatePlaying_RapidInOrder(TriggeredBehaviour nextIncomplete) { if (_nextActivate >= _behaviours.Count) { if (nextIncomplete.IsReady && nextIncomplete.CurPlaysRequested >= 0) { RequestComplete(); } return; } TriggeredBehaviour behaviour = _behaviours[_nextActivate]; if (behaviour.IsReady) { behaviour.RequestPlaying(_lastTriggerer); } _nextActivate++; }