private void ValueChangedInternal(T value) { UnrealBinaryHeapEx <T> collection = GetCollection(value.Owner.Group); collection.HeapRemove(value); collection.HeapPush(value); }
internal void Process(ulong value) { cancelInvoke = false; int expectedAdditionalCallCount = 0; if (IsRepeated) { expectedAdditionalCallCount = (int)((value - EndValue) / RepeatedValue); } CallCount = expectedAdditionalCallCount + 1; // Clamp the call count to MaxCallCount int clampedAdditionalCallCount = expectedAdditionalCallCount; if (MaxCallCount > 0) { clampedAdditionalCallCount = Math.Min(MaxCallCount - 1, clampedAdditionalCallCount); } // target value may change if IsFirstRun is true ulong oldTargetValue = CurrentTargetValue; if (!InvokeInternal() || (HasStopAfterValue && HasStopAfterValueCompleted(oldTargetValue, 0))) { return; } uint additionalCalls = 0; for (; additionalCalls < clampedAdditionalCallCount && !cancelInvoke && Running; ++additionalCalls) { if (!InvokeInternal() || (HasStopAfterValue && HasStopAfterValueCompleted(oldTargetValue, additionalCalls + 1))) { return; } } if (IsRepeated) { if (RepeatConstantTime && Type == InvokerType.Delay) { ulong realTime = (ulong)WorldTimeHelper.GetTimeChecked(OwnerWorld).Ticks; BeginValue = value + (realTime - EndValue); } else { BeginValue += oldTargetValue + (additionalCalls * RepeatedValue); } collection.HeapPush(this); } else { collection = null; collectionGroup = null; Stop(); } }
private bool AddInternal(T value) { UnrealBinaryHeapEx <T> collection = GetCollection(value.Owner.Group); collection.HeapPush(value); value.comparableCollection = this; return(true); }
private void OnGroupChanged(T instruction, CoroutineGroup oldGroup, CoroutineGroup newGroup) { UnrealBinaryHeapEx <T> oldCollection = GetCollection(oldGroup); UnrealBinaryHeapEx <T> newCollection = GetCollection(newGroup); if (oldCollection != null && newCollection != null && oldCollection != newCollection) { oldCollection.HeapRemove(instruction); newCollection.HeapPush(instruction); } }
private void UpdateValues(bool setStartValue) { if (!Running) { return; } if (setStartValue) { switch (Type) { case InvokerType.Delay: BeginValue = startingValue = (ulong)WorldTimeHelper.GetTimeChecked(OwnerWorld).Ticks; break; case InvokerType.Ticks: BeginValue = startingValue = EngineLoop.WorldTickCounter; break; case InvokerType.Frames: BeginValue = startingValue = EngineLoop.WorldFrameNumber; break; } } InvokerCollectionGroup newCollectionGroup = GetInvokerGroup(Group); UnrealBinaryHeapEx <Invoker> newCollection = newCollectionGroup == null ? null : newCollectionGroup.GetCollection(Type); if (collectionGroup != null && collection != null) { if (collectionGroup.Group != Group || newCollection != collection) { collection.HeapRemove(this); collection = null; collectionGroup = null; } } if (newCollection != null) { collectionGroup = newCollectionGroup; collection = newCollection; newCollection.HeapPush(this); } }