public void Delete(KGFEventSequenceEntry theElementToDelete) { if (itsEntries.Count > 1) { itsEntries.Remove(theElementToDelete); } }
public void MoveDown(KGFEventSequenceEntry theElementToMoveDown) { int anIndex = itsEntries.IndexOf(theElementToMoveDown); if (anIndex >= itsEntries.Count - 1) { KGFEvent.LogWarning("cannot move down element at end index", itsEventCategory, this); return; } Delete(theElementToMoveDown); itsEntries.Insert(anIndex + 1, theElementToMoveDown); }
public void MoveUp(KGFEventSequenceEntry theElementToMoveUp) { int anIndex = itsEntries.IndexOf(theElementToMoveUp); if (anIndex <= 0) { KGFEvent.LogWarning("cannot move up element at 0 index", itsEventCategory, this); return; } Delete(theElementToMoveUp); itsEntries.Insert(anIndex - 1, theElementToMoveUp); }
/// <summary> /// Checks for errors in the inspector /// </summary> public override KGFMessageList Validate() { KGFMessageList aReturnValue = new KGFMessageList(); bool aHasNullEvent = false; bool aWaitBeforeError = false; bool aWaitAfterError = false; if (itsEntries != null) { for (int i = 0; i < itsEntries.Count; i++) { KGFEventSequenceEntry anEntry = itsEntries[i]; if (anEntry.itsEvent == null) { aHasNullEvent = true; } if (anEntry.itsWaitBefore < 0) { aWaitBeforeError = true; } if (anEntry.itsWaitAfter < 0) { aWaitAfterError = true; } } } if (aHasNullEvent) { aReturnValue.AddError("sequence entry has null event"); } if (aWaitBeforeError) { aReturnValue.AddError("sequence entry itsWaitBefore <= 0"); } if (aWaitAfterError) { aReturnValue.AddError("sequence entry itsWaitAfter <= 0"); } return(aReturnValue); }
public void MoveDown(KGFEventSequenceEntry theElementToMoveDown) { int anIndex = itsEntries.IndexOf(theElementToMoveDown); if(anIndex >= itsEntries.Count-1) { KGFEvent.LogWarning("cannot move down element at end index",itsEventCategory,this); return; } Delete(theElementToMoveDown); itsEntries.Insert(anIndex+1,theElementToMoveDown); }
public void MoveUp(KGFEventSequenceEntry theElementToMoveUp) { int anIndex = itsEntries.IndexOf(theElementToMoveUp); if(anIndex <= 0) { KGFEvent.LogWarning("cannot move up element at 0 index",itsEventCategory,this); return; } Delete(theElementToMoveUp); itsEntries.Insert(anIndex-1,theElementToMoveUp); }
public void Delete(KGFEventSequenceEntry theElementToDelete) { if(itsEntries.Count > 1) itsEntries.Remove(theElementToDelete); }
public void Insert(KGFEventSequenceEntry theElementAfterToInsert,KGFEventSequenceEntry theElementToInsert) { int anIndex = itsEntries.IndexOf(theElementAfterToInsert); itsEntries.Insert(anIndex+1,theElementToInsert); }
/// <summary> /// The sequence waits for itsWaits[i] seconds and fires itsEvents[i] /// </summary> /// <returns> /// A <see cref="IEnumerator"/> /// </returns> IEnumerator StartSequence() { itsStayBeforeStepID = 0; if (!itsListOfRunningSequences.Contains(this)) { itsListOfRunningSequences.Add(this); } // do not start sequnce if counter is not set if (itsEventDoneCounter == null) { yield break; } // for all entries, start at the current counter position for (int i = itsEventDoneCounter.GetValueOrDefault(0); i < itsEntries.Count; i++) { KGFEventSequenceEntry anEntry = itsEntries[i]; // wait some time if (anEntry.itsWaitBefore > 0) { yield return(new WaitForSeconds(anEntry.itsWaitBefore)); } #if UNITY_EDITOR // only for debug while (itsStepMode && i >= itsStayBeforeStepID) { yield return(new WaitForSeconds(0.2f)); } #endif // if(itsEventSequenceRunning == false) //event sequence and coroutine was stopped. This here should never happen. -> just to make really sure! // Debugger.LogError(this,"continuing stopped coroutine!!!"); // trigger event try{ if (anEntry.itsEvent != null) { anEntry.itsEvent.Trigger(); } else { KGFEvent.LogError("events have null entries", itsEventCategory, this); } } catch (System.Exception e) { KGFEvent.LogError("Exception in event_sequence:" + e, itsEventCategory, this); } // increase counter itsEventDoneCounter = i + 1; // wait some time if (anEntry.itsWaitAfter > 0) { yield return(new WaitForSeconds(anEntry.itsWaitAfter)); } } // set counter to inactive itsEventDoneCounter = null; itsEventSequenceRunning = false; // remove from running list if (itsListOfRunningSequences.Contains(this)) { itsListOfRunningSequences.Remove(this); } }
public void Insert(KGFEventSequenceEntry theElementAfterToInsert, KGFEventSequenceEntry theElementToInsert) { int anIndex = itsEntries.IndexOf(theElementAfterToInsert); itsEntries.Insert(anIndex + 1, theElementToInsert); }