Esempio n. 1
0
 public void Tick()
 {
     lock ( physicsLock ) {
         if (!physicsEnabled)
         {
             return;
         }
         tickNumber++;
         if (tickNumber % 5 == 0)
         {
             int oldLength = tickQueue.Count;
             for (int i = 0; i < oldLength; i++)
             {
                 PhysicsUpdate update = tickQueue.Dequeue();
                 if (update.Delay > 0)
                 {
                     update.Delay--;
                     tickQueue.Enqueue(update);
                 }
                 else if (update.OldBlock == GetBlock(update.X, update.Y, update.Z))
                 {
                     PhysicsOnTick(update.X, update.Y, update.Z, update.OldBlock);
                 }
             }
         }
         plantPhysics.Tick(tickNumber);
     }
 }
Esempio n. 2
0
        public void PhysicsQueueTick(int x, int y, int z, Block oldBlock)
        {
            if (!InBounds(x, y, z))
            {
                return;
            }
            PhysicsUpdate update = new PhysicsUpdate(x, y, z, oldBlock, TickDelays[(int)oldBlock]);

            lock ( physicsLock ) {
                tickQueue.Enqueue(update);
            }
        }
Esempio n. 3
0
 public void PhysicsQueueTick( int x, int y, int z, Block oldBlock )
 {
     if( !InBounds( x, y, z ) )
         return;
     PhysicsUpdate update = new PhysicsUpdate( x, y, z, oldBlock, TickDelays[(int)oldBlock] );
     lock( physicsLock ) {
         tickQueue.Enqueue( update );
     }
 }