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


C# Level.setData方法代码示例

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


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

示例1: tick

        public override void tick(Level level, int xt, int yt)
        {
            if (random.nextInt(2) == 0) return;

            int age = level.getData(xt, yt);
            if (age < 50) level.setData(xt, yt, age + 1);
        }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:7,代码来源:WheatTile.cs

示例2: steppedOn

 public override void steppedOn(Level level, int x, int y, Entity entity)
 {
     if (entity is Mob)
     {
         level.setData(x, y, 10);
     }
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:7,代码来源:SandTile.cs

示例3: tick

 public override void tick(Level level, int x, int y)
 {
     int age = level.getData(x, y) + 1;
     if (age > 100)
     {
         level.setTile(x, y, growsTo, 0);
     }
     else
     {
         level.setData(x, y, age);
     }
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:12,代码来源:SaplingTile.cs

示例4: hurt

 public override void hurt(Level level, int x, int y, Mob source, int dmg, int attackDir)
 {
     int damage = level.getData(x, y) + dmg;
     level.add(new SmashParticle(x * 16 + 8, y * 16 + 8));
     level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, ColorHelper.get(-1, 500, 500, 500)));
     if (damage >= 10)
     {
         int count = random.nextInt(2) + 1;
         for (int i = 0; i < count; i++)
         {
             level.add(new ItemEntity(new ResourceItem(Resource.cactusFlower), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
         }
         level.setTile(x, y, Tile.sand, 0);
     }
     else
     {
         level.setData(x, y, damage);
     }
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:19,代码来源:CactusTile.cs

示例5: hurt

 public void hurt(Level level, int x, int y, int dmg)
 {
     int damage = level.getData(x, y) + 1;
     level.add(new SmashParticle(x * 16 + 8, y * 16 + 8));
     level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, ColorHelper.get(-1, 500, 500, 500)));
     if (dmg > 0)
     {
         int count = random.nextInt(2);
         if (damage >= random.nextInt(10) + 3)
         {
             level.setTile(x, y, Tile.dirt, 0);
             count += 2;
         }
         else
         {
             level.setData(x, y, damage);
         }
         for (int i = 0; i < count; i++)
         {
             level.add(new ItemEntity(new ResourceItem(toDrop), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
         }
     }
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:23,代码来源:OreTile.cs

示例6: tick

 public override void tick(Level level, int xt, int yt)
 {
     int damage = level.getData(xt, yt);
     if (damage > 0) level.setData(xt, yt, damage - 1);
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:5,代码来源:HardRockTile.cs

示例7: tick

 public override void tick(Level level, int xt, int yt)
 {
     int age = level.getData(xt, yt);
     if (age < 5) level.setData(xt, yt, age + 1);
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:5,代码来源:FarmTile.cs

示例8: tick

 public override void tick(Level level, int x, int y)
 {
     int d = level.getData(x, y);
     if (d > 0) level.setData(x, y, d - 1);
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:5,代码来源:SandTile.cs

示例9: hurt

 private void hurt(Level level, int x, int y, int dmg)
 {
     {
         int count = random.nextInt(10) == 0 ? 1 : 0;
         for (int i = 0; i < count; i++)
         {
             level.add(new ItemEntity(new ResourceItem(Resource.apple), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
         }
     }
     int damage = level.getData(x, y) + dmg;
     level.add(new SmashParticle(x * 16 + 8, y * 16 + 8));
     level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, ColorHelper.get(-1, 500, 500, 500)));
     if (damage >= 20)
     {
         int count = random.nextInt(2) + 1;
         for (int i = 0; i < count; i++)
         {
             level.add(new ItemEntity(new ResourceItem(Resource.wood), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
         }
         count = random.nextInt(random.nextInt(4) + 1);
         for (int i = 0; i < count; i++)
         {
             level.add(new ItemEntity(new ResourceItem(Resource.acorn), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
         }
         level.setTile(x, y, Tile.grass, 0);
     }
     else
     {
         level.setData(x, y, damage);
     }
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:31,代码来源:TreeTile.cs


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