本文整理汇总了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);
}
示例2: steppedOn
public override void steppedOn(Level level, int x, int y, Entity entity)
{
if (entity is Mob)
{
level.setData(x, y, 10);
}
}
示例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);
}
}
示例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);
}
}
示例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));
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}