Esempio n. 1
0
	private void SubInitializeAboutAction(string kind){
		switch(kind){	
			case "KIND1":
				action = new Kind1_Action_(this);
			break;
		}
	}
Esempio n. 2
0
 void ProcessActions()
 {
     Move(mainThreadActions, actions);
     while (actions.Count() > 0)
     {
         Action_ a = actions.Dequeue();
         a.Run();
     }
 }
Esempio n. 3
0
    public Action_ Dequeue()
    {
        Action_ ret = items[start];

        items[start] = null;
        start++;
        start = start % max;
        count--;
        return(ret);
    }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
    public void Enqueue(Action_ value)
    {
        if (count == max)
        {
            Resize(max * 2);
        }
        int pos = start + count;

        pos = pos % max;
        count++;
        items[pos] = value;
    }
Esempio n. 6
0
    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);
    }
Esempio n. 7
0
 internal void Add(Action_ action)
 {
     items[count++] = action;
 }
Esempio n. 8
0
 public abstract void QueueUserWorkItem(Action_ action);
Esempio n. 9
0
 public override void QueueUserWorkItem(Action_ action)
 {
     ThreadPool.QueueUserWorkItem((a) => { action.Run(); });
 }
Esempio n. 10
0
 public void QueueMainThreadAction(Action_ action)
 {
     platform.MonitorEnter(mainThreadActionsLock);
     mainThreadActions.Enqueue(action);
     platform.MonitorExit(mainThreadActionsLock);
 }
Esempio n. 11
0
 public abstract void QueueUserWorkItem(Action_ action);
Esempio n. 12
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 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;
	}
Esempio n. 13
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;
		}
	}
Esempio n. 14
0
 public void Enqueue(Action_ value)
 {
     if (count == max)
     {
         Resize(max * 2);
     }
     int pos = start + count;
     pos = pos % max;
     count++;
     items[pos] = value;
 }
Esempio n. 15
0
 void Start(int max_)
 {
     max   = max_;
     items = new Action_[max_];
     count = 0;
 }
Esempio n. 16
0
 internal void Add(Action_ action)
 {
     items[count++] = action;
 }
Esempio n. 17
0
 public void QueueActionCommit(Action_ action)
 {
     commitActions.Add(action);
 }
Esempio n. 18
0
 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;
 }
Esempio n. 19
0
 public void QueueMainThreadAction(Action_ action)
 {
     platform.MonitorEnter(mainThreadActionsLock);
     mainThreadActions.Enqueue(action);
     platform.MonitorExit(mainThreadActionsLock);
 }