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


C# Level.getData方法代码示例

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


在下文中一共展示了Level.getData方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

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

        public override void render(Screen screen, Level level, int x, int y)
        {
            base.render(screen, level, x, y);

            int data = level.getData(x, y);
            int shape = (data / 16) % 2;
            int flowerCol = ColorHelper.get(10, level.grassColor, 555, 440);

            if (shape == 0) screen.render(x * 16 + 0, y * 16 + 0, 1 + 1 * 32, flowerCol, 0);
            if (shape == 1) screen.render(x * 16 + 8, y * 16 + 0, 1 + 1 * 32, flowerCol, 0);
            if (shape == 1) screen.render(x * 16 + 0, y * 16 + 8, 1 + 1 * 32, flowerCol, 0);
            if (shape == 0) screen.render(x * 16 + 8, y * 16 + 8, 1 + 1 * 32, flowerCol, 0);
        }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:13,代码来源:FlowerTile.cs

示例5: render

        public override void render(Screen screen, Level level, int x, int y)
        {
            int col = ColorHelper.get(level.sandColor + 2, level.sandColor, level.sandColor - 110, level.sandColor - 110);
            int transitionColor = ColorHelper.get(level.sandColor - 110, level.sandColor, level.sandColor - 110, level.dirtColor);

            bool u = !level.getTile(x, y - 1).connectsToSand;
            bool d = !level.getTile(x, y + 1).connectsToSand;
            bool l = !level.getTile(x - 1, y).connectsToSand;
            bool r = !level.getTile(x + 1, y).connectsToSand;

            bool steppedOn = level.getData(x, y) > 0;

            if (!u && !l)
            {
                if (!steppedOn)
                    screen.render(x * 16 + 0, y * 16 + 0, 0, col, 0);
                else
                    screen.render(x * 16 + 0, y * 16 + 0, 3 + 1 * 32, col, 0);
            }
            else
                screen.render(x * 16 + 0, y * 16 + 0, (l ? 11 : 12) + (u ? 0 : 1) * 32, transitionColor, 0);

            if (!u && !r)
            {
                screen.render(x * 16 + 8, y * 16 + 0, 1, col, 0);
            }
            else
                screen.render(x * 16 + 8, y * 16 + 0, (r ? 13 : 12) + (u ? 0 : 1) * 32, transitionColor, 0);

            if (!d && !l)
            {
                screen.render(x * 16 + 0, y * 16 + 8, 2, col, 0);
            }
            else
                screen.render(x * 16 + 0, y * 16 + 8, (l ? 11 : 12) + (d ? 2 : 1) * 32, transitionColor, 0);
            if (!d && !r)
            {
                if (!steppedOn)
                    screen.render(x * 16 + 8, y * 16 + 8, 3, col, 0);
                else
                    screen.render(x * 16 + 8, y * 16 + 8, 3 + 1 * 32, col, 0);

            }
            else
                screen.render(x * 16 + 8, y * 16 + 8, (r ? 13 : 12) + (d ? 2 : 1) * 32, transitionColor, 0);
        }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:46,代码来源:SandTile.cs

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

示例7: render

        public override void render(Screen screen, Level level, int x, int y)
        {
            int age = level.getData(x, y);
            int col = ColorHelper.get(level.dirtColor - 121, level.dirtColor - 11, level.dirtColor, 50);
            int icon = age / 10;
            if (icon >= 3)
            {
                col = ColorHelper.get(level.dirtColor - 121, level.dirtColor - 11, 50 + (icon) * 100, 40 + (icon - 3) * 2 * 100);
                if (age == 50)
                {
                    col = ColorHelper.get(0, 0, 50 + (icon) * 100, 40 + (icon - 3) * 2 * 100);
                }
                icon = 3;
            }

            screen.render(x * 16 + 0, y * 16 + 0, 4 + 3 * 32 + icon, col, 0);
            screen.render(x * 16 + 8, y * 16 + 0, 4 + 3 * 32 + icon, col, 0);
            screen.render(x * 16 + 0, y * 16 + 8, 4 + 3 * 32 + icon, col, 1);
            screen.render(x * 16 + 8, y * 16 + 8, 4 + 3 * 32 + icon, col, 1);
        }
开发者ID:xposure,项目名称:MiniCraft.NET,代码行数:20,代码来源:WheatTile.cs

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

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

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

示例12: steppedOn

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

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

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