本文整理汇总了C#中Level.getTile方法的典型用法代码示例。如果您正苦于以下问题:C# Level.getTile方法的具体用法?C# Level.getTile怎么用?C# Level.getTile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level.getTile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: render
public override void render(Screen screen, Level level, int x, int y)
{
int col = ColorHelper.get(334, 334, 223, 223);
int transitionColor = ColorHelper.get(001, 334, 445, level.dirtColor);
bool u = level.getTile(x, y - 1) != this;
bool d = level.getTile(x, y + 1) != this;
bool l = level.getTile(x - 1, y) != this;
bool r = level.getTile(x + 1, y) != this;
bool ul = level.getTile(x - 1, y - 1) != this;
bool dl = level.getTile(x - 1, y + 1) != this;
bool ur = level.getTile(x + 1, y - 1) != this;
bool dr = level.getTile(x + 1, y + 1) != this;
if (!u && !l)
{
if (!ul)
screen.render(x * 16 + 0, y * 16 + 0, 0, col, 0);
else
screen.render(x * 16 + 0, y * 16 + 0, 7 + 0 * 32, transitionColor, 3);
}
else
screen.render(x * 16 + 0, y * 16 + 0, (l ? 6 : 5) + (u ? 2 : 1) * 32, transitionColor, 3);
if (!u && !r)
{
if (!ur)
screen.render(x * 16 + 8, y * 16 + 0, 1, col, 0);
else
screen.render(x * 16 + 8, y * 16 + 0, 8 + 0 * 32, transitionColor, 3);
}
else
screen.render(x * 16 + 8, y * 16 + 0, (r ? 4 : 5) + (u ? 2 : 1) * 32, transitionColor, 3);
if (!d && !l)
{
if (!dl)
screen.render(x * 16 + 0, y * 16 + 8, 2, col, 0);
else
screen.render(x * 16 + 0, y * 16 + 8, 7 + 1 * 32, transitionColor, 3);
}
else
screen.render(x * 16 + 0, y * 16 + 8, (l ? 6 : 5) + (d ? 0 : 1) * 32, transitionColor, 3);
if (!d && !r)
{
if (!dr)
screen.render(x * 16 + 8, y * 16 + 8, 3, col, 0);
else
screen.render(x * 16 + 8, y * 16 + 8, 8 + 1 * 32, transitionColor, 3);
}
else
screen.render(x * 16 + 8, y * 16 + 8, (r ? 4 : 5) + (d ? 0 : 1) * 32, transitionColor, 3);
}
示例3: render
public override void render(Screen screen, Level level, int x, int y)
{
int col = ColorHelper.get(444, 444, 555, 555);
int transitionColor = ColorHelper.get(333, 444, 555, -1);
bool u = level.getTile(x, y - 1) == Tile.infiniteFall;
bool d = level.getTile(x, y + 1) == Tile.infiniteFall;
bool l = level.getTile(x - 1, y) == Tile.infiniteFall;
bool r = level.getTile(x + 1, y) == Tile.infiniteFall;
bool ul = level.getTile(x - 1, y - 1) == Tile.infiniteFall;
bool dl = level.getTile(x - 1, y + 1) == Tile.infiniteFall;
bool ur = level.getTile(x + 1, y - 1) == Tile.infiniteFall;
bool dr = level.getTile(x + 1, y + 1) == Tile.infiniteFall;
if (!u && !l)
{
if (!ul)
screen.render(x * 16 + 0, y * 16 + 0, 17, col, 0);
else
screen.render(x * 16 + 0, y * 16 + 0, 7 + 0 * 32, transitionColor, 3);
}
else
screen.render(x * 16 + 0, y * 16 + 0, (l ? 6 : 5) + (u ? 2 : 1) * 32, transitionColor, 3);
if (!u && !r)
{
if (!ur)
screen.render(x * 16 + 8, y * 16 + 0, 18, col, 0);
else
screen.render(x * 16 + 8, y * 16 + 0, 8 + 0 * 32, transitionColor, 3);
}
else
screen.render(x * 16 + 8, y * 16 + 0, (r ? 4 : 5) + (u ? 2 : 1) * 32, transitionColor, 3);
if (!d && !l)
{
if (!dl)
screen.render(x * 16 + 0, y * 16 + 8, 20, col, 0);
else
screen.render(x * 16 + 0, y * 16 + 8, 7 + 1 * 32, transitionColor, 3);
}
else
screen.render(x * 16 + 0, y * 16 + 8, (l ? 6 : 5) + (d ? 0 : 1) * 32, transitionColor, 3);
if (!d && !r)
{
if (!dr)
screen.render(x * 16 + 8, y * 16 + 8, 19, col, 0);
else
screen.render(x * 16 + 8, y * 16 + 8, 8 + 1 * 32, transitionColor, 3);
}
else
screen.render(x * 16 + 8, y * 16 + 8, (r ? 4 : 5) + (d ? 0 : 1) * 32, transitionColor, 3);
}
示例4: render
public override void render(Screen screen, Level level, int x, int y)
{
int col = ColorHelper.get(10, 30, 151, level.grassColor);
int barkCol1 = ColorHelper.get(10, 30, 430, level.grassColor);
int barkCol2 = ColorHelper.get(10, 30, 320, level.grassColor);
bool u = level.getTile(x, y - 1) == this;
bool l = level.getTile(x - 1, y) == this;
bool r = level.getTile(x + 1, y) == this;
bool d = level.getTile(x, y + 1) == this;
bool ul = level.getTile(x - 1, y - 1) == this;
bool ur = level.getTile(x + 1, y - 1) == this;
bool dl = level.getTile(x - 1, y + 1) == this;
bool dr = level.getTile(x + 1, y + 1) == this;
if (u && ul && l)
{
screen.render(x * 16 + 0, y * 16 + 0, 10 + 1 * 32, col, 0);
}
else
{
screen.render(x * 16 + 0, y * 16 + 0, 9 + 0 * 32, col, 0);
}
if (u && ur && r)
{
screen.render(x * 16 + 8, y * 16 + 0, 10 + 2 * 32, barkCol2, 0);
}
else
{
screen.render(x * 16 + 8, y * 16 + 0, 10 + 0 * 32, col, 0);
}
if (d && dl && l)
{
screen.render(x * 16 + 0, y * 16 + 8, 10 + 2 * 32, barkCol2, 0);
}
else
{
screen.render(x * 16 + 0, y * 16 + 8, 9 + 1 * 32, barkCol1, 0);
}
if (d && dr && r)
{
screen.render(x * 16 + 8, y * 16 + 8, 10 + 1 * 32, col, 0);
}
else
{
screen.render(x * 16 + 8, y * 16 + 8, 10 + 3 * 32, barkCol2, 0);
}
}
示例5: render
public override void render(Screen screen, Level level, int x, int y)
{
int col = ColorHelper.get(level.grassColor, level.grassColor, level.grassColor + 111, level.grassColor + 111);
int transitionColor = ColorHelper.get(level.grassColor - 111, level.grassColor, level.grassColor + 111, level.dirtColor);
bool u = !level.getTile(x, y - 1).connectsToGrass;
bool d = !level.getTile(x, y + 1).connectsToGrass;
bool l = !level.getTile(x - 1, y).connectsToGrass;
bool r = !level.getTile(x + 1, y).connectsToGrass;
if (!u && !l)
{
screen.render(x * 16 + 0, y * 16 + 0, 0, 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)
{
screen.render(x * 16 + 8, y * 16 + 8, 3, col, 0);
}
else
screen.render(x * 16 + 8, y * 16 + 8, (r ? 13 : 12) + (d ? 2 : 1) * 32, transitionColor, 0);
}
示例6: 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);
}
}
示例7: render
public override void render(Screen screen, Level level, int x, int y)
{
wRandom = new Random((int)((tickCount + (x / 2 - y) * 4311) / 10 * 54687121L + x * 3271612L + y * 3412987161L));
//TODO: wRandom.setSeed((tickCount + (x / 2 - y) * 4311) / 10 * 54687121L + x * 3271612L + y * 3412987161L);
int col = ColorHelper.get(500, 500, 520, 550);
int transitionColor1 = ColorHelper.get(3, 500, level.dirtColor - 111, level.dirtColor);
int transitionColor2 = ColorHelper.get(3, 500, level.sandColor - 110, level.sandColor);
bool u = !level.getTile(x, y - 1).connectsToLava;
bool d = !level.getTile(x, y + 1).connectsToLava;
bool l = !level.getTile(x - 1, y).connectsToLava;
bool r = !level.getTile(x + 1, y).connectsToLava;
bool su = u && level.getTile(x, y - 1).connectsToSand;
bool sd = d && level.getTile(x, y + 1).connectsToSand;
bool sl = l && level.getTile(x - 1, y).connectsToSand;
bool sr = r && level.getTile(x + 1, y).connectsToSand;
if (!u && !l)
{
screen.render(x * 16 + 0, y * 16 + 0, wRandom.nextInt(4), col, wRandom.nextInt(4));
}
else
screen.render(x * 16 + 0, y * 16 + 0, (l ? 14 : 15) + (u ? 0 : 1) * 32, (su || sl) ? transitionColor2 : transitionColor1, 0);
if (!u && !r)
{
screen.render(x * 16 + 8, y * 16 + 0, wRandom.nextInt(4), col, wRandom.nextInt(4));
}
else
screen.render(x * 16 + 8, y * 16 + 0, (r ? 16 : 15) + (u ? 0 : 1) * 32, (su || sr) ? transitionColor2 : transitionColor1, 0);
if (!d && !l)
{
screen.render(x * 16 + 0, y * 16 + 8, wRandom.nextInt(4), col, wRandom.nextInt(4));
}
else
screen.render(x * 16 + 0, y * 16 + 8, (l ? 14 : 15) + (d ? 2 : 1) * 32, (sd || sl) ? transitionColor2 : transitionColor1, 0);
if (!d && !r)
{
screen.render(x * 16 + 8, y * 16 + 8, wRandom.nextInt(4), col, wRandom.nextInt(4));
}
else
screen.render(x * 16 + 8, y * 16 + 8, (r ? 16 : 15) + (d ? 2 : 1) * 32, (sd || sr) ? transitionColor2 : transitionColor1, 0);
}
示例8: render
public override void render(Screen screen, Level level, int x, int y)
{
int col = ColorHelper.get(111, 111, 110, 110);
int transitionColor1 = ColorHelper.get(3, 111, level.dirtColor - 111, level.dirtColor);
int transitionColor2 = ColorHelper.get(3, 111, level.sandColor - 110, level.sandColor);
bool u = !level.getTile(x, y - 1).connectsToLiquid();
bool d = !level.getTile(x, y + 1).connectsToLiquid();
bool l = !level.getTile(x - 1, y).connectsToLiquid();
bool r = !level.getTile(x + 1, y).connectsToLiquid();
bool su = u && level.getTile(x, y - 1).connectsToSand;
bool sd = d && level.getTile(x, y + 1).connectsToSand;
bool sl = l && level.getTile(x - 1, y).connectsToSand;
bool sr = r && level.getTile(x + 1, y).connectsToSand;
if (!u && !l)
{
screen.render(x * 16 + 0, y * 16 + 0, 0, col, 0);
}
else
screen.render(x * 16 + 0, y * 16 + 0, (l ? 14 : 15) + (u ? 0 : 1) * 32, (su || sl) ? transitionColor2 : transitionColor1, 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 ? 16 : 15) + (u ? 0 : 1) * 32, (su || sr) ? transitionColor2 : transitionColor1, 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 ? 14 : 15) + (d ? 2 : 1) * 32, (sd || sl) ? transitionColor2 : transitionColor1, 0);
if (!d && !r)
{
screen.render(x * 16 + 8, y * 16 + 8, 3, col, 0);
}
else
screen.render(x * 16 + 8, y * 16 + 8, (r ? 16 : 15) + (d ? 2 : 1) * 32, (sd || sr) ? transitionColor2 : transitionColor1, 0);
}
示例9: findStartPos
public override bool findStartPos(Level level)
{
while (true)
{
int x = random.nextInt(level.w);
int y = random.nextInt(level.h);
if (level.getTile(x, y) == Tile.grass)
{
this.x = x * 16 + 8;
this.y = y * 16 + 8;
return true;
}
}
}
示例10: findStartPos
public virtual bool findStartPos(Level level)
{
int x = random.nextInt(level.w);
int y = random.nextInt(level.h);
int xx = x * 16 + 8;
int yy = y * 16 + 8;
if (level.player != null)
{
int xd = level.player.x - xx;
int yd = level.player.y - yy;
if (xd * xd + yd * yd < 80 * 80) return false;
}
int r = level.monsterDensity * 16;
if (level.getEntities(xx - r, yy - r, xx + r, yy + r).size() > 0) return false;
if (level.getTile(x, y).mayPass(level, x, y, this))
{
this.x = xx;
this.y = yy;
return true;
}
return false;
}