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


C# Level.setTile方法代码示例

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


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

示例1: interact

 public override bool interact(Level level, int xt, int yt, Player player, Item item, int attackDir)
 {
     if (item is ToolItem)
     {
         ToolItem tool = (ToolItem)item;
         if (tool.type == ToolType.shovel)
         {
             if (player.payStamina(4 - tool.level))
             {
                 level.setTile(xt, yt, Tile.hole, 0);
                 level.add(new ItemEntity(new ResourceItem(Resource.dirt), xt * 16 + random.nextInt(10) + 3, yt * 16 + random.nextInt(10) + 3));
                 Sound.monsterHurt.play();
                 return true;
             }
         }
         if (tool.type == ToolType.hoe)
         {
             if (player.payStamina(4 - tool.level))
             {
                 level.setTile(xt, yt, Tile.farmland, 0);
                 Sound.monsterHurt.play();
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:27,代码来源:DirtTile.cs

示例2: hurt

 public override void hurt(Level level, int x, int y, Mob source, int dmg, int attackDir)
 {
     int count = random.nextInt(2) + 1;
     for (int i = 0; i < count; i++)
     {
         level.add(new ItemEntity(new ResourceItem(Resource.flower), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
     }
     level.setTile(x, y, Tile.grass, 0);
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:9,代码来源:FlowerTile.cs

示例3: interactOn

 public override bool interactOn(Tile tile, Level level, int xt, int yt, Player player, int attackDir)
 {
     if (sourceTiles.Contains((TileID)tile.id))
     {
         var tt = Tile.tiles[(byte)targetTile];
         level.setTile(xt, yt, tt, 0);
         return true;
     }
     return false;
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:10,代码来源:PlantableResource.cs

示例4: 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

示例5: tick

        public override void tick(Level level, int xt, int yt)
        {
            int xn = xt;
            int yn = yt;

            if (random.nextbool())
                xn += random.nextInt(2) * 2 - 1;
            else
                yn += random.nextInt(2) * 2 - 1;

            if (level.getTile(xn, yn) == Tile.hole)
            {
                level.setTile(xn, yn, this, 0);
            }
        }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:15,代码来源:LavaTile.cs

示例6: interact

 public override bool interact(Level level, int xt, int yt, Player player, Item item, int attackDir)
 {
     if (item is ToolItem)
     {
         ToolItem tool = (ToolItem)item;
         if (tool.type == ToolType.shovel)
         {
             if (player.payStamina(4 - tool.level))
             {
                 level.setTile(xt, yt, Tile.dirt, 0);
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:16,代码来源:FarmTile.cs

示例7: interact

 public override bool interact(Level level, int x, int y, Player player, Item item, int attackDir)
 {
     if (item is ToolItem)
     {
         ToolItem tool = (ToolItem)item;
         if (tool.type == ToolType.shovel)
         {
             if (player.payStamina(4 - tool.level))
             {
                 level.add(new ItemEntity(new ResourceItem(Resource.flower), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
                 level.add(new ItemEntity(new ResourceItem(Resource.flower), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
                 level.setTile(x, y, Tile.grass, 0);
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:18,代码来源:FlowerTile.cs

示例8: 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

示例9: 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

示例10: steppedOn

 public override void steppedOn(Level level, int xt, int yt, Entity entity)
 {
     if (random.nextInt(60) != 0) return;
     if (level.getData(xt, yt) < 5) return;
     level.setTile(xt, yt, Tile.dirt, 0);
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:6,代码来源:FarmTile.cs

示例11: harvest

        private void harvest(Level level, int x, int y)
        {
            int age = level.getData(x, y);

            int count = random.nextInt(2);
            for (int i = 0; i < count; i++)
            {
                level.add(new ItemEntity(new ResourceItem(Resource.seeds), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
            }

            count = 0;
            if (age == 50)
            {
                count = random.nextInt(3) + 2;
            }
            else if (age >= 40)
            {
                count = random.nextInt(2) + 1;
            }
            for (int i = 0; i < count; i++)
            {
                level.add(new ItemEntity(new ResourceItem(Resource.wheat), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
            }

            level.setTile(x, y, Tile.dirt, 0);
        }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:26,代码来源:WheatTile.cs

示例12: 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

示例13: hurt

 public override void hurt(Level level, int x, int y, Mob source, int dmg, int attackDir)
 {
     level.setTile(x, y, onType, 0);
 }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:4,代码来源:SaplingTile.cs


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