本文整理匯總了C#中Terraria.Tile.active方法的典型用法代碼示例。如果您正苦於以下問題:C# Tile.active方法的具體用法?C# Tile.active怎麽用?C# Tile.active使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Terraria.Tile
的用法示例。
在下文中一共展示了Tile.active方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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();
}
示例2: SolidOrSlopedTile
public static bool SolidOrSlopedTile(Tile tile)
{
return tile != null && tile.active() && Main.tileSolid[(int)tile.type] && !Main.tileSolidTop[(int)tile.type] && !tile.inActive();
}
示例3: GetTileData
public static TileObjectData GetTileData(Tile getTile)
{
int num;
if (getTile == null || !getTile.active())
{
return null;
}
int num1 = getTile.type;
if (num1 < 0 || num1 >= TileObjectData._data.Count)
{
throw new ArgumentOutOfRangeException("Function called with a bad tile type");
}
TileObjectData item = TileObjectData._data[num1];
if (item == null)
{
return null;
}
int num2 = getTile.frameX / item.CoordinateFullWidth;
int num3 = getTile.frameY / item.CoordinateFullHeight;
int styleWrapLimit = item.StyleWrapLimit;
if (styleWrapLimit == 0)
{
styleWrapLimit = 1;
}
num = (!item.StyleHorizontal ? num2 * styleWrapLimit + num3 : num3 * styleWrapLimit + num2);
int styleMultiplier = num / item.StyleMultiplier;
int styleMultiplier1 = num % item.StyleMultiplier;
if (item.SubTiles != null && styleMultiplier >= 0 && styleMultiplier < item.SubTiles.Count)
{
TileObjectData tileObjectDatum = item.SubTiles[styleMultiplier];
if (tileObjectDatum != null)
{
item = tileObjectDatum;
}
}
if (item._alternates != null)
{
for (int i = 0; i < item.Alternates.Count; i++)
{
TileObjectData item1 = item.Alternates[i];
if (item1 != null && styleMultiplier1 >= item1.Style && styleMultiplier1 <= item1.Style + item1.RandomStyleRange)
{
return item1;
}
}
}
return item;
}
示例4: CheckWaterDeath
public static bool CheckWaterDeath(Tile checkTile)
{
if (!checkTile.active())
{
return false;
}
TileObjectData tileData = TileObjectData.GetTileData(checkTile);
if (tileData != null)
{
return tileData.WaterDeath;
}
return Main.tileWaterDeath[checkTile.type];
}
示例5: CompressedTileBody
private void CompressedTileBody(byte flags, Tile tile)
{
Byte(flags);
var type = tile.type;
var wall = tile.wall;
var liquid = tile.liquid;
if (tile.active())
{
if ((flags & 32) != 0)
{
Byte(type);
}
if ((flags & 64) != 0)
{
Short(tile.frameX);
Short(tile.frameY);
}
}
if ((flags & 4) != 0)
{
Byte(wall);
}
if ((flags & 8) != 0)
{
Byte(liquid);
}
}
示例6: PlaceTrack
public static void PlaceTrack(Tile trackCache, int style)
{
trackCache.active(true);
trackCache.type = 314;
trackCache.frameY = -1;
switch (style)
{
case 0:
{
trackCache.frameX = -1;
return;
}
case 1:
{
trackCache.frameX = Minecart._firstPressureFrame;
return;
}
case 2:
{
trackCache.frameX = Minecart._firstLeftBoostFrame;
return;
}
case 3:
{
trackCache.frameX = Minecart._firstRightBoostFrame;
return;
}
default:
{
return;
}
}
}
示例7: isTheSameAs
public bool isTheSameAs(Tile compTile)
{
if (compTile == null)
{
return false;
}
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;
}
}
}
if (this.wall != compTile.wall)
{
return false;
}
if (this.liquid != compTile.liquid)
{
return false;
}
if (this.liquid > 0)
{
if (this.lava() != compTile.lava())
{
return false;
}
if (this.honey() != compTile.honey())
{
return false;
}
}
return this.wire() == compTile.wire() && this.wire2() == compTile.wire2() && this.wire3() == compTile.wire3() && this.halfBrick() == compTile.halfBrick() && this.actuator() == compTile.actuator() && this.inActive() == compTile.inActive() && this.wallColor() == compTile.wallColor() && this.color() == compTile.color() && this.slope() == compTile.slope();
}
示例8: ReadTile
public static Tile ReadTile(this BinaryReader reader)
{
Tile tile = new Tile();
tile.sTileHeader = reader.ReadInt16();
tile.bTileHeader = reader.ReadByte();
tile.bTileHeader2 = reader.ReadByte();
// Tile type
if (tile.active())
{
tile.type = reader.ReadUInt16();
if (Main.tileFrameImportant[tile.type])
{
tile.frameX = reader.ReadInt16();
tile.frameY = reader.ReadInt16();
}
}
tile.wall = reader.ReadByte();
tile.liquid = reader.ReadByte();
return tile;
}
示例9: WriteTile
public static void WriteTile(BinaryWriter writer, Tile tile)
{
byte flags = 0;
if (tile.active())
{
flags |= 1;
}
if (tile.wall != 0)
{
flags |= 2;
}
if (tile.liquid > 0)
{
flags |= 4;
}
if (tile.lava())
{
flags |= 8;
}
if (tile.wire())
{
flags |= 16;
}
writer.Write(flags);
if ((flags & 1) == 1)
{
writer.Write(tile.type);
if (Main.tileFrameImportant[tile.type])
{
writer.Write(tile.frameNumber());
writer.Write(tile.frameX);
writer.Write(tile.frameY);
}
}
if ((flags & 2) == 2)
{
writer.Write(tile.wall);
}
if ((flags & 4) == 4)
{
writer.Write(tile.liquid);
}
}
示例10: ReadTile
public static Tile ReadTile(BinaryReader reader)
{
Tile tile = new Tile();
byte flags = reader.ReadByte();
if ((flags & 1) == 1)
{
byte type = reader.ReadByte();
tile.active(true);
tile.type = type;
if (Main.tileFrameImportant[type])
{
tile.frameNumber(reader.ReadByte());
tile.frameX = reader.ReadInt16();
tile.frameY = reader.ReadInt16();
}
else
{
tile.frameX = -1;
tile.frameY = -1;
}
}
if ((flags & 2) == 2)
{
tile.wall = reader.ReadByte();
}
if ((flags & 4) == 4)
{
tile.liquid = reader.ReadByte();
}
if ((flags & 8) == 8)
{
tile.lava(true);
}
if ((flags & 16) == 16)
{
tile.wire(true);
}
return tile;
}
示例11: BlockPortals
private static bool BlockPortals(Tile t)
{
if (t.active() && !Main.tileCut[t.type] && !TileID.Sets.BreakableWhenPlacing[t.type] && Main.tileSolid[t.type])
{
return true;
}
return false;
}
示例12: BlockPortals
private static bool BlockPortals(Tile t)
{
return t.active() && !Main.tileCut[(int)t.type] && (!TileID.Sets.BreakableWhenPlacing[(int)t.type] && Main.tileSolid[(int)t.type]);
}
示例13: TileSize
//#if TEST_COMPRESSION
private int TileSize(Tile tile)
{
int count = 1;
var active = tile.active();
var wall = tile.wall;
var liquid = tile.liquid;
if (active)
{
var type = tile.type;
count += 1;
if (Main.tileFrameImportant[type])
{
count += 4;
}
}
if (wall > 0)
{
count += 1;
}
if (liquid > 0)
{
count += 2;
}
return count;
}
示例14: Tile
private void Tile(Tile tile)
{
byte flags = 0;
var active = tile.active();
var wall = tile.wall;
var liquid = tile.liquid;
if (active) flags += 1;
//if (tile.Lighted) flags += 2; //UNUSED
if (wall > 0) flags += 4;
if (liquid > 0) flags += 8;
if (tile.wire()) flags += 16;
if (tile.halfBrick()) flags += 32;
if (tile.actuator()) flags += 64;
if (tile.inActive()) flags += 128;
Byte(flags);
byte tileColour = 0, wallColour = 0;
flags = 0;
if (tile.wire2()) flags += 1;
if (tile.wire3()) flags += 2;
if (tile.active() && tile.color() > 0)
{
flags += 4;
tileColour = tile.color();
}
if (tile.wall > 0 && tile.wallColor() > 0)
{
flags += 8;
wallColour = tile.wallColor();
}
Byte(flags + (byte)(tile.slope() << 4));
if (tileColour > 0) Byte(tileColour);
if (wallColour > 0) Byte(wallColour);
if (tile.active())
{
UShort(tile.type);
if (Main.tileFrameImportant[(int)tile.type])
{
Short(tile.frameX);
Short(tile.frameY);
}
}
if (tile.wall > 0) Byte(tile.wall);
if (tile.liquid > 0)
{
Byte(tile.liquid);
Byte(tile.liquidType());
}
}
示例15: CompressedTileFlags
private byte CompressedTileFlags(Tile tile, Tile last)
{
byte flags = 0;
var active = tile.active();
var type = tile.type;
if (active != last.active()) flags |= 1;
//if (tile.lighted != last.) flags |= 2;
if (tile.wall != last.wall) flags |= 4;
if (tile.liquid != last.liquid) flags |= 8;
if (tile.lava() != last.lava()) flags |= 16;
if (active)
{
if (last.type != type || (flags & 1) != 0) flags |= 32;
if (Main.tileFrameImportant[type] && (last.frameX != tile.frameX || last.frameY != tile.frameY || (flags & 1) != 0))
{
flags |= 64;
}
}
return flags;
}