Example #1
0
        public UpdateTaskGeneric(Action <T> updateAction, Func <T, bool> endCondition, T sender, Action endAction = null)
        {
            EndAction   = endAction;
            dataQueue   = new Queue <ActionGenericData>();
            currentData = new ActionGenericData(updateAction, endCondition, sender);

            this.sender = sender;

            if (sender is UnityEngine.Object obj)
            {
                CalledInstanceId = obj.GetInstanceID();
            }
        }
Example #2
0
        public void Tick()
        {
            currentData.Invoke();

            if (!currentData.CheckEnd())
            {
                if (dataQueue.Count == 0)
                {
                    EndAction?.Invoke();
                    Dispose();
                    return;
                }
                currentData = dataQueue.Dequeue();
            }
        }
Example #3
0
 public UpdateTaskGeneric <T> Join(ActionGenericData actionData)
 {
     dataQueue.Enqueue(actionData);
     return(this);
 }