当前位置: 首页>>代码示例>>C#>>正文


C# IWorld.FindChunk方法代码示例

本文整理汇总了C#中IWorld.FindChunk方法的典型用法代码示例。如果您正苦于以下问题:C# IWorld.FindChunk方法的具体用法?C# IWorld.FindChunk怎么用?C# IWorld.FindChunk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWorld的用法示例。


在下文中一共展示了IWorld.FindChunk方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BlockLoadedFromChunk

 public override void BlockLoadedFromChunk(Coordinates3D coords, IMultiplayerServer server, IWorld world)
 {
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent("farmland", chunk,
         TimeSpan.FromSeconds(UpdateIntervalSeconds),
         s => HydrationCheckEvent(s, coords, world));
 }
开发者ID:ComputeLinux,项目名称:TrueCraft,代码行数:7,代码来源:FarmlandBlock.cs

示例2: BlockPlaced

 public override void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
 {
     var chunk = world.FindChunk(descriptor.Coordinates);
     user.Server.Scheduler.ScheduleEvent(chunk,
         DateTime.UtcNow.AddSeconds(MathHelper.Random.Next(MinGrowthTime, MaxGrowthTime)),
         s => TrySpread(descriptor.Coordinates, world, user.Server));
 }
开发者ID:zevipa,项目名称:TrueCraft,代码行数:7,代码来源:GrassBlock.cs

示例3: BlockPlaced

 public override void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
 {
     var chunk = world.FindChunk(descriptor.Coordinates);
     user.Server.Scheduler.ScheduleEvent("crops", chunk,
         TimeSpan.FromSeconds(MathHelper.Random.Next(30, 60)),
         (server) => GrowBlock(server, world, descriptor.Coordinates + MathHelper.BlockFaceToCoordinates(face)));
 }
开发者ID:ComputeLinux,项目名称:TrueCraft,代码行数:7,代码来源:CropsBlock.cs

示例4: BlockLoadedFromChunk

 public override void BlockLoadedFromChunk(Coordinates3D coords, IMultiplayerServer server, IWorld world)
 {
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent("cactus", chunk,
         TimeSpan.FromSeconds(MathHelper.Random.Next(MinGrowthSeconds, MaxGrowthSeconds)),
         s => TryGrowth(s, coords, world));
 }
开发者ID:ComputeLinux,项目名称:TrueCraft,代码行数:7,代码来源:CactusBlock.cs

示例5: BlockLoadedFromChunk

 public override void BlockLoadedFromChunk(Coordinates3D coords, IMultiplayerServer server, IWorld world)
 {
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent(chunk,
         DateTime.UtcNow.AddSeconds(MathHelper.Random.Next(MinGrowthTime, MaxGrowthTime)),
         s => TrySpread(coords, world, server));
 }
开发者ID:zevipa,项目名称:TrueCraft,代码行数:7,代码来源:GrassBlock.cs

示例6: BlockLoadedFromChunk

 public override void BlockLoadedFromChunk(Coordinates3D coords, IMultiplayerServer server, IWorld world)
 {
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent("crops", chunk,
         TimeSpan.FromSeconds(MathHelper.Random.Next(30, 60)),
         (s) => GrowBlock(s, world, coords));
 }
开发者ID:ComputeLinux,项目名称:TrueCraft,代码行数:7,代码来源:CropsBlock.cs

示例7: ScheduleNextEvent

 public void ScheduleNextEvent(Coordinates3D coords, IWorld world, IMultiplayerServer server)
 {
     if (world.GetBlockID(coords) == StillID)
         return;
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent("fluid", chunk,
         TimeSpan.FromSeconds(SecondsBetweenUpdates), (_server) =>
         AutomataUpdate(_server, world, coords));
 }
开发者ID:Zoxive,项目名称:TrueCraft,代码行数:9,代码来源:FluidBlock.cs

示例8: BlockPlaced

 public override void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
 {
     if (IsHydrated(descriptor.Coordinates, world))
     {
         world.SetMetadata(descriptor.Coordinates, 1);
     }
     var chunk = world.FindChunk(descriptor.Coordinates);
     user.Server.Scheduler.ScheduleEvent(chunk,
         DateTime.UtcNow.AddSeconds(UpdateIntervalSeconds),
         server => HydrationCheckEvent(server, descriptor.Coordinates, world));
 }
开发者ID:Gbear605,项目名称:TrueCraft,代码行数:11,代码来源:FarmlandBlock.cs

示例9: GrowBlock

 private void GrowBlock(IMultiplayerServer server, IWorld world, Coordinates3D coords)
 {
     if (world.GetBlockID(coords) != BlockID)
         return;
     var meta = world.GetMetadata(coords);
     meta++;
     world.SetMetadata(coords, meta);
     if (meta < 7)
     {
         var chunk = world.FindChunk(coords);
         server.Scheduler.ScheduleEvent("crops",
             chunk, TimeSpan.FromSeconds(MathHelper.Random.Next(30, 60)),
            (_server) => GrowBlock(_server, world, coords));
     }
 }
开发者ID:Zoxive,项目名称:TrueCraft,代码行数:15,代码来源:CropsBlock.cs

示例10: BlockUpdate

 public override void BlockUpdate(BlockDescriptor descriptor, BlockDescriptor source, IMultiplayerServer server, IWorld world)
 {
     if (source.Coordinates == descriptor.Coordinates + Coordinates3D.Up)
     {
         var provider = world.BlockRepository.GetBlockProvider(source.ID);
         if (provider.Opaque)
         {
             var chunk = world.FindChunk(descriptor.Coordinates, generate: false);
             server.Scheduler.ScheduleEvent("grass", chunk,
             TimeSpan.FromSeconds(MathHelper.Random.Next(MinDecayTime, MaxDecayTime)), s =>
             {
                 ScheduledUpdate(world, descriptor.Coordinates);
             });
         }
     }
 }
开发者ID:Zoxive,项目名称:TrueCraft,代码行数:16,代码来源:GrassBlock.cs

示例11: BlockPlaced

        public override void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
        {
            if (ValidCactusPosition(descriptor, user.Server.BlockRepository, world))
                base.BlockPlaced(descriptor, face, world, user);
            else
            {
                world.SetBlockID(descriptor.Coordinates, AirBlock.BlockID);

                var manager = user.Server.GetEntityManagerForWorld(world);
                manager.SpawnEntity(
                    new ItemEntity(descriptor.Coordinates + Coordinates3D.Up,
                        new ItemStack(CactusBlock.BlockID, (sbyte)1)));
                // user.Inventory.PickUpStack() wasn't working?
            }

            var chunk = world.FindChunk(descriptor.Coordinates);
            user.Server.Scheduler.ScheduleEvent("cactus", chunk,
                TimeSpan.FromSeconds(MathHelper.Random.Next(MinGrowthSeconds, MaxGrowthSeconds)),
                (server) => TryGrowth(server, descriptor.Coordinates, world));
        }
开发者ID:ComputeLinux,项目名称:TrueCraft,代码行数:20,代码来源:CactusBlock.cs

示例12: ScheduleUpdate

 public void ScheduleUpdate(IMultiplayerServer server, IWorld world, BlockDescriptor descriptor)
 {
     var chunk = world.FindChunk(descriptor.Coordinates);
     server.Scheduler.ScheduleEvent("fire.spread", chunk,
         TimeSpan.FromSeconds(MathHelper.Random.Next(MinSpreadTime, MaxSpreadTime)),
         s => DoUpdate(s, world, descriptor));
 }
开发者ID:ComputeLinux,项目名称:TrueCraft,代码行数:7,代码来源:FireBlock.cs

示例13: HydrationCheckEvent

 void HydrationCheckEvent(IMultiplayerServer server, Coordinates3D coords, IWorld world)
 {
     if (world.GetBlockID(coords) != BlockID)
         return;
     if (MathHelper.Random.Next(3) == 0)
     {
         var meta = world.GetMetadata(coords);
         if (IsHydrated(coords, world) && meta != 15)
             meta++;
         else
         {
             meta--;
             if (meta == 0)
             {
                 world.SetBlockID(coords, BlockID);
                 return;
             }
         }
         world.SetMetadata(coords, meta);
     }
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent(chunk,
         DateTime.UtcNow.AddSeconds(UpdateIntervalSeconds),
         _server => HydrationCheckEvent(_server, coords, world));
 }
开发者ID:Gbear605,项目名称:TrueCraft,代码行数:25,代码来源:FarmlandBlock.cs

示例14: TrySpread

 public void TrySpread(Coordinates3D coords, IWorld world, IMultiplayerServer server)
 {
     if (!world.IsValidPosition(coords + Coordinates3D.Up))
         return;
     var sky = world.GetSkyLight(coords + Coordinates3D.Up);
     var block = world.GetBlockLight(coords + Coordinates3D.Up);
     if (sky < 9 && block < 9)
         return;
     for (int i = 0, j = MathHelper.Random.Next(GrowthCandidates.Length); i < GrowthCandidates.Length; i++, j++)
     {
         var candidate = GrowthCandidates[j % GrowthCandidates.Length] + coords;
         if (!world.IsValidPosition(candidate) || !world.IsValidPosition(candidate + Coordinates3D.Up))
             continue;
         var id = world.GetBlockID(candidate);
         if (id == DirtBlock.BlockID)
         {
             var _sky = world.GetSkyLight(candidate + Coordinates3D.Up);
             var _block = world.GetBlockLight(candidate + Coordinates3D.Up);
             if (_sky < 4 && _block < 4)
                 continue;
             IChunk chunk = world.FindChunk(candidate);
             bool grow = true;
             for (int y = candidate.Y; y < chunk.GetHeight((byte)candidate.X, (byte)candidate.Z); y++)
             {
                 var b = world.GetBlockID(new Coordinates3D(candidate.X, y, candidate.Z));
                 var p = world.BlockRepository.GetBlockProvider(b);
                 if (p.LightOpacity >= 2)
                 {
                     grow = false;
                     break;
                 }
             }
             world.SetBlockID(candidate, GrassBlock.BlockID);
             server.Scheduler.ScheduleEvent(chunk,
                 DateTime.UtcNow.AddSeconds(MathHelper.Random.Next(MinGrowthTime, MaxGrowthTime)),
                 s => TrySpread(candidate, world, server));
             break;
         }
     }
 }
开发者ID:KayleeSmall,项目名称:TrueCraft,代码行数:40,代码来源:GrassBlock.cs

示例15: TryGrowth

 private void TryGrowth(IMultiplayerServer server, Coordinates3D coords, IWorld world)
 {
     if (world.GetBlockID(coords) != BlockID)
         return;
     // Find current height of stalk
     int height = 0;
     for (int y = -MaxGrowHeight; y <= MaxGrowHeight; y++)
     {
         if (world.GetBlockID(coords + (Coordinates3D.Down * y)) == BlockID)
             height++;
     }
     if (height < MaxGrowHeight)
     {
         var meta = world.GetMetadata(coords);
         meta++;
         world.SetMetadata(coords, meta);
         var chunk = world.FindChunk(coords);
         if (meta == 15)
         {
             if (world.GetBlockID(coords + Coordinates3D.Up) == 0)
             {
                 world.SetBlockID(coords + Coordinates3D.Up, BlockID);
                 server.Scheduler.ScheduleEvent("cactus", chunk,
                     TimeSpan.FromSeconds(MathHelper.Random.Next(MinGrowthSeconds, MaxGrowthSeconds)),
                     (_server) => TryGrowth(_server, coords + Coordinates3D.Up, world));
             }
         }
         else
         {
             server.Scheduler.ScheduleEvent("cactus", chunk,
                 TimeSpan.FromSeconds(MathHelper.Random.Next(MinGrowthSeconds, MaxGrowthSeconds)),
                 (_server) => TryGrowth(_server, coords, world));
         }
     }
 }
开发者ID:ComputeLinux,项目名称:TrueCraft,代码行数:35,代码来源:CactusBlock.cs


注:本文中的IWorld.FindChunk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。