private void SubInitializeAboutAction(string kind){ switch(kind){ case "KIND1": action = new Kind1_Action_(this); break; } }
void ProcessActions() { Move(mainThreadActions, actions); while (actions.Count() > 0) { Action_ a = actions.Dequeue(); a.Run(); } }
public Action_ Dequeue() { Action_ ret = items[start]; items[start] = null; start++; start = start % max; count--; return(ret); }
void Resize(int newSize) { Action_[] items2 = new Action_[newSize]; for (int i = 0; i < max; i++) { items2[i] = items[(start + i) % max]; } items = items2; start = 0; max = newSize; }
public void Enqueue(Action_ value) { if (count == max) { Resize(max * 2); } int pos = start + count; pos = pos % max; count++; items[pos] = value; }
void Move(QueueAction from, QueueAction to) { platform.MonitorEnter(mainThreadActionsLock); int count = from.count; for (int i = 0; i < count; i++) { Action_ task = from.Dequeue(); to.Enqueue(task); } platform.MonitorExit(mainThreadActionsLock); }
internal void Add(Action_ action) { items[count++] = action; }
public abstract void QueueUserWorkItem(Action_ action);
public override void QueueUserWorkItem(Action_ action) { ThreadPool.QueueUserWorkItem((a) => { action.Run(); }); }
public void QueueMainThreadAction(Action_ action) { platform.MonitorEnter(mainThreadActionsLock); mainThreadActions.Enqueue(action); platform.MonitorExit(mainThreadActionsLock); }
public abstract void QueueUserWorkItem(Action_ action);
private void SubInitializeAboutAction(string type) { switch(type) { case "KIND1": action = new Type1(this); break; case "KIND2": action = new Type2(this); break; case "FEED_SMALL": action = new FeedSmall(this); break; case "FEED_RANDOM": action = new FeedRandom(this); break; case "FEED_BIGSINE": action = new FeedBigSine(this); break; case "FEED_BIGCOSINE": action = new FeedBigCosine(this); break; case "FEED_BIGSINEEX": action = new FeedBigSineEx(this); break; case "FEED_BIGCOSINEEX": action = new FeedBigCosineEx(this); break; } col = transform.collider as CapsuleCollider; col.radius = 16.0f * sizeOfFish; col.height = 100.0f * sizeOfFish; col.direction = 0; }
private void SubInitializeAboutAction(string type) { switch(type) { case "KIND1": action = new Type1(this); break; case "KIND2": action = new Type2(this); break; case "FEED_SMALL": action = new Type3(this); break; } }
public void Enqueue(Action_ value) { if (count == max) { Resize(max * 2); } int pos = start + count; pos = pos % max; count++; items[pos] = value; }
void Start(int max_) { max = max_; items = new Action_[max_]; count = 0; }
internal void Add(Action_ action) { items[count++] = action; }
public void QueueActionCommit(Action_ action) { commitActions.Add(action); }
void Resize(int newSize) { Action_[] items2 = new Action_[newSize]; for (int i = 0; i < max; i++) { items2[i] = items[(start + i) % max]; } items = items2; start = 0; max = newSize; }
public void QueueMainThreadAction(Action_ action) { platform.MonitorEnter(mainThreadActionsLock); mainThreadActions.Enqueue(action); platform.MonitorExit(mainThreadActionsLock); }