示例#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);
     }
 }
示例#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);
            }
        }
示例#3
0
文件: Map.cs 项目: fragmer/FemtoCraft
 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 );
     }
 }