本文整理匯總了C#中Terraria.Tile類的典型用法代碼示例。如果您正苦於以下問題:C# Tile類的具體用法?C# Tile怎麽用?C# Tile使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Tile類屬於Terraria命名空間,在下文中一共展示了Tile類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: isTheSameAs
public bool isTheSameAs(Tile compTile)
{
if (this.active != compTile.active)
{
return false;
}
if (this.active)
{
if (this.type != compTile.type)
{
return false;
}
if (Main.tileFrameImportant[(int)this.type])
{
if (this.frameX != compTile.frameX)
{
return false;
}
if (this.frameY != compTile.frameY)
{
return false;
}
}
}
return this.wall == compTile.wall && this.liquid == compTile.liquid && this.lava == compTile.lava && this.wire == compTile.wire;
}
示例2: LiquidRenderer
static LiquidRenderer()
{
LiquidRenderer.WATERFALL_LENGTH = new int[] { 10, 3, 2 };
LiquidRenderer.DEFAULT_OPACITY = new float[] { 0.6f, 0.95f, 0.95f };
LiquidRenderer.EMPTY_TILE = new Tile();
LiquidRenderer.Instance = new LiquidRenderer();
}
示例3: Tile
public Tile(Tile copy)
{
if (copy == null)
{
this.type = 0;
this.wall = 0;
this.liquid = 0;
this.sTileHeader = 0;
this.bTileHeader = 0;
this.bTileHeader2 = 0;
this.bTileHeader3 = 0;
this.frameX = 0;
this.frameY = 0;
return;
}
this.type = copy.type;
this.wall = copy.wall;
this.liquid = copy.liquid;
this.sTileHeader = copy.sTileHeader;
this.bTileHeader = copy.bTileHeader;
this.bTileHeader2 = copy.bTileHeader2;
this.bTileHeader3 = copy.bTileHeader3;
this.frameX = copy.frameX;
this.frameY = copy.frameY;
}
示例4: IsTileTheSame
public static bool IsTileTheSame(Tile tile1, Tile tile2)
{
if (tile1.active() != tile2.active())
return false;
if (tile1.active())
{
if (tile1.type != tile2.type)
return false;
if (Main.tileFrameImportant[(int)tile1.type])
{
if ((tile1.frameX != tile2.frameX) || (tile1.frameX != tile2.frameX))
return false;
}
}
return
tile1.wall == tile2.wall
&&
tile1.liquid == tile2.liquid
&&
tile1.lava() == tile2.lava()
&&
tile1.wire() == tile2.wire()
&&
tile1.wire2() == tile2.wire2()
&&
tile1.wire3() == tile2.wire3();
}
示例5: TileEvent
public TileEvent(Tile tile, Player player, int changeType)
: base(player)
{
base.setState(false);
this.tile = tile;
this.changeType = changeType;
}
示例6: GetTileSafely
public static Tile GetTileSafely(int i, int j)
{
Tile tile = Main.tile[i, j];
if (tile == null)
{
tile = new Tile();
Main.tile[i, j] = tile;
}
return tile;
}
示例7: WorldRenderer
public WorldRenderer(Tile[,] tiles, int worldWidth, int worldHeight, double worldSurface, double rockLayer)
{
Tiles = tiles;
MaxX = worldWidth;
MaxY = worldHeight;
SurfaceY = (int)worldSurface;
RockLayerY = (int)rockLayer + (600 / 16);
HellLayerY = MaxY - 195;
Colors = TerrariaColors.GetColors();
}
示例8: LoadWorldData
public static Tile[,] LoadWorldData(string path)
{
Tile[,] tile;
using (BinaryReader reader = new BinaryReader(new FileStream(path, FileMode.Open)))
{
int xLen = reader.ReadInt32();
int yLen = reader.ReadInt32();
tile = new Tile[xLen, yLen];
for (int i = 0; i < xLen; i++)
{
for (int j = 0; j < yLen; j++)
{
tile[i, j] = ReadTile(reader);
}
}
return tile;
}
}
示例9: isTheSameAs
public bool isTheSameAs(Tile compTile)
{
if (this.active != compTile.active)
{
return false;
}
if (this.active)
{
if (this.type != compTile.type)
{
return false;
}
if (Main.tileFrameImportant[this.type])
{
if (this.frameX != compTile.frameX)
{
return false;
}
if (this.frameY != compTile.frameY)
{
return false;
}
}
}
if (this.wall != compTile.wall)
{
return false;
}
if (this.liquid != compTile.liquid)
{
return false;
}
if (this.lava != compTile.lava)
{
return false;
}
if (this.wire != compTile.wire)
{
return false;
}
return true;
}
示例10: k_Constructor
public void k_Constructor(Tile copy)
{
if (copy == null)
{
k_block = null;
k_wall_protoID = 0;
k_wall_variant = 0;
k_wall_colourID = 0;
k_liquid_protoID = 0;
k_liquid_amount = 0;
k_wireFlags = 0;
}
else
{
k_block = copy.k_block.Copy();
k_wall_protoID = copy.k_wall_protoID;
k_wall_variant = copy.k_wall_variant;
k_wall_colourID = copy.k_wall_colourID;
k_liquid_protoID = copy.k_liquid_protoID;
k_liquid_amount = copy.k_liquid_amount;
k_wireFlags = copy.k_wireFlags;
}
}
示例11: LoadWorldData
public static Tile[,] LoadWorldData(string path)
{
Tile[,] tile;
// GZipStream is already buffered, but it's much faster to have a 1 MB buffer.
using (var reader =
new BinaryReader(
new BufferedStream(
new GZipStream(File.Open(path, FileMode.Open), CompressionMode.Decompress), BUFFER_SIZE)))
{
reader.ReadInt32();
reader.ReadInt32();
int width = reader.ReadInt32();
int height = reader.ReadInt32();
tile = new Tile[width, height];
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
tile[i, j] = ReadTile(reader);
}
return tile;
}
}
示例12: Tiles
public Tiles(Tile Maintile, Point Loc)
{
this.maintile = Maintile;
this.loc = Loc;
}
示例13: DrawWaterfall
//.........這裏部分代碼省略.........
Rectangle value = new Rectangle(num24 * 18, 0, 16, 16);
Rectangle value2 = new Rectangle(num23 * 18, 0, 16, 16);
Vector2 origin = new Vector2(8f, 8f);
Vector2 position;
if (num14 % 2 == 0)
{
position = new Vector2((float)(num13 * 16 + 9), (float)(num14 * 16 + 8)) - Main.screenPosition;
}
else
{
position = new Vector2((float)(num13 * 16 + 8), (float)(num14 * 16 + 8)) - Main.screenPosition;
}
bool flag = false;
for (int j = 0; j < num22; j++)
{
Color color = Lighting.GetColor(num13, num14);
float num25 = 0.6f;
float num26 = 0.3f;
if (j > num22 - 8)
{
float num27 = (float)(num22 - j) / 8f;
num25 *= num27;
num26 *= num27;
}
Color color2 = color * num25;
Color color3 = color * num26;
spriteBatch.Draw(this.waterfallTexture[12], position, new Rectangle?(value), color3, 0f, origin, 1f, SpriteEffects.None, 0f);
spriteBatch.Draw(this.waterfallTexture[11], position, new Rectangle?(value2), color2, 0f, origin, 1f, SpriteEffects.None, 0f);
if (flag)
{
break;
}
num14++;
Tile tile = Main.tile[num13, num14];
if (WorldGen.SolidTile(tile))
{
flag = true;
}
if (tile.liquid > 0)
{
int num28 = (int)(16f * ((float)tile.liquid / 255f)) & 254;
if (num28 >= 15)
{
break;
}
value2.Height -= num28;
value.Height -= num28;
}
if (num14 % 2 == 0)
{
position.X += 1f;
}
else
{
position.X -= 1f;
}
position.Y += 16f;
}
this.waterfalls[i].stopAtStep = 0;
}
}
}
IL_1879:
i++;
continue;
IL_3FA:
示例14: SolidTile
public static bool SolidTile(Tile testTile)
{
try
{
if (testTile == null)
{
bool result = true;
return result;
}
if (testTile.active() && Main.tileSolid[(int)testTile.type] && !Main.tileSolidTop[(int)testTile.type] && !testTile.halfBrick() && testTile.slope() == 0 && !testTile.inActive())
{
bool result = true;
return result;
}
}
catch
{
}
return false;
}
示例15: TrackColors
public static void TrackColors(int i, int j, Tile trackTile, out int frontColor, out int backColor)
{
int num;
int num1;
Tile tile;
int num2;
if (trackTile.type != 314)
{
frontColor = 0;
backColor = 0;
}
else
{
frontColor = trackTile.color();
backColor = frontColor;
if (trackTile.frameY == -1)
{
return;
}
int num3 = Minecart._leftSideConnection[trackTile.frameX];
int num4 = Minecart._rightSideConnection[trackTile.frameX];
int num5 = Minecart._leftSideConnection[trackTile.frameY];
int num6 = Minecart._rightSideConnection[trackTile.frameY];
int num7 = 0;
int num8 = 0;
int num9 = 0;
int num10 = 0;
for (int i1 = 0; i1 < 4; i1++)
{
switch (i1)
{
case 1:
{
num = num4;
break;
}
case 2:
{
num = num5;
break;
}
case 3:
{
num = num6;
break;
}
default:
{
num = num3;
break;
}
}
switch (num)
{
case 0:
{
num1 = -1;
break;
}
case 1:
{
num1 = 0;
break;
}
case 2:
{
num1 = 1;
break;
}
default:
{
num1 = 0;
break;
}
}
tile = (i1 % 2 != 0 ? Main.tile[i + 1, j + num1] : Main.tile[i - 1, j + num1]);
if (tile == null || !tile.active() || tile.type != 314)
{
num2 = 0;
}
else
{
num2 = tile.color();
}
switch (i1)
{
case 1:
{
num8 = num2;
break;
}
case 2:
{
num9 = num2;
break;
}
case 3:
{
num10 = num2;
break;
//.........這裏部分代碼省略.........