本文整理汇总了C#中Server.StaticTile类的典型用法代码示例。如果您正苦于以下问题:C# StaticTile类的具体用法?C# StaticTile怎么用?C# StaticTile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StaticTile类属于Server命名空间,在下文中一共展示了StaticTile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MultiComponentList
public MultiComponentList( MultiComponentList toCopy )
{
m_Min = toCopy.m_Min;
m_Max = toCopy.m_Max;
m_Center = toCopy.m_Center;
m_Width = toCopy.m_Width;
m_Height = toCopy.m_Height;
m_Tiles = new StaticTile[m_Width][][];
for ( int x = 0; x < m_Width; ++x )
{
m_Tiles[x] = new StaticTile[m_Height][];
for ( int y = 0; y < m_Height; ++y )
{
m_Tiles[x][y] = new StaticTile[toCopy.m_Tiles[x][y].Length];
for ( int i = 0; i < m_Tiles[x][y].Length; ++i )
m_Tiles[x][y][i] = toCopy.m_Tiles[x][y][i];
}
}
m_List = new MultiTileEntry[toCopy.m_List.Length];
for ( int i = 0; i < m_List.Length; ++i )
m_List[i] = toCopy.m_List[i];
}
开发者ID:Godkong,项目名称:Origins,代码行数:30,代码来源:MultiData.cs
示例2: ToArray
public StaticTile[] ToArray()
{
if (this.m_Count == 0)
return m_EmptyTiles;
StaticTile[] tiles = new StaticTile[this.m_Count];
for (int i = 0; i < this.m_Count; ++i)
tiles[i] = this.m_Tiles[i];
this.m_Count = 0;
return tiles;
}
开发者ID:m309,项目名称:ForkUO,代码行数:14,代码来源:TileList.cs
示例3: AddRange
public void AddRange( StaticTile[] tiles )
{
if ( (m_Count + tiles.Length) > m_Tiles.Length )
{
StaticTile[] old = m_Tiles;
m_Tiles = new StaticTile[(m_Count + tiles.Length) * 2];
for ( int i = 0; i < old.Length; ++i )
m_Tiles[i] = old[i];
}
for ( int i = 0; i < tiles.Length; ++i )
m_Tiles[m_Count++] = tiles[i];
}
开发者ID:Godkong,项目名称:Origins,代码行数:14,代码来源:TileList.cs
示例4: AddRange
public void AddRange(StaticTile[] tiles)
{
if ((this.m_Count + tiles.Length) > this.m_Tiles.Length)
{
StaticTile[] old = this.m_Tiles;
this.m_Tiles = new StaticTile[(this.m_Count + tiles.Length) * 2];
for (int i = 0; i < old.Length; ++i)
this.m_Tiles[i] = old[i];
}
for (int i = 0; i < tiles.Length; ++i)
this.m_Tiles[this.m_Count++] = tiles[i];
}
开发者ID:m309,项目名称:ForkUO,代码行数:14,代码来源:TileList.cs
示例5: PatchTiles
public static StaticTile[] PatchTiles(StaticTile[] tiles, int season)
{
if ( season <= 0 || season >= SeasonCount )
return tiles;
var tileChanges = m_TileChanges[season];
if ( tileChanges != null )
{
for ( int i = 0; i < tiles.Length; i++ )
{
if (tileChanges.ContainsKey(tiles[i].ID))
tiles[i].ID = tileChanges[tiles[i].ID];
}
}
return tiles;
}
开发者ID:zerodowned,项目名称:JustUO-merged-with-EC-Support,代码行数:17,代码来源:Season.cs
示例6: IsOk
private bool IsOk( bool ignoreDoors, bool ignoreSpellFields, int ourZ, int ourTop, StaticTile[] tiles, List<Item> items )
{
for ( int i = 0; i < tiles.Length; ++i )
{
StaticTile check = tiles[i];
ItemData itemData = TileData.ItemTable[check.ID & TileData.MaxItemValue];
if ( (itemData.Flags & ImpassableSurface) != 0 ) // Impassable || Surface
{
int checkZ = check.Z;
int checkTop = checkZ + itemData.CalcHeight;
if ( checkTop > ourZ && ourTop > checkZ )
return false;
}
}
for ( int i = 0; i < items.Count; ++i )
{
Item item = items[i];
int itemID = item.ItemID & TileData.MaxItemValue;
ItemData itemData = TileData.ItemTable[itemID];
TileFlag flags = itemData.Flags;
if ( (flags & ImpassableSurface) != 0 ) // Impassable || Surface
{
if ( ignoreDoors && ((flags & TileFlag.Door) != 0 || itemID == 0x692 || itemID == 0x846 || itemID == 0x873 || (itemID >= 0x6F5 && itemID <= 0x6F6)) )
continue;
if ( ignoreSpellFields && ( itemID == 0x82 || itemID == 0x3946 || itemID == 0x3956 ) )
continue;
int checkZ = item.Z;
int checkTop = checkZ + itemData.CalcHeight;
if ( checkTop > ourZ && ourTop > checkZ )
return false;
}
}
return true;
}
开发者ID:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:42,代码来源:Movement.cs
示例7: Resize
public void Resize( int newWidth, int newHeight )
{
int oldWidth = m_Width, oldHeight = m_Height;
StaticTile[][][] oldTiles = m_Tiles;
int totalLength = 0;
StaticTile[][][] newTiles = new StaticTile[newWidth][][];
for ( int x = 0; x < newWidth; ++x )
{
newTiles[x] = new StaticTile[newHeight][];
for ( int y = 0; y < newHeight; ++y )
{
if ( x < oldWidth && y < oldHeight )
newTiles[x][y] = oldTiles[x][y];
else
newTiles[x][y] = new StaticTile[0];
totalLength += newTiles[x][y].Length;
}
}
m_Tiles = newTiles;
m_List = new MultiTileEntry[totalLength];
m_Width = newWidth;
m_Height = newHeight;
m_Min = Point2D.Zero;
m_Max = Point2D.Zero;
int index = 0;
for ( int x = 0; x < newWidth; ++x )
{
for ( int y = 0; y < newHeight; ++y )
{
StaticTile[] tiles = newTiles[x][y];
for ( int i = 0; i < tiles.Length; ++i )
{
StaticTile tile = tiles[i];
int vx = x - m_Center.X;
int vy = y - m_Center.Y;
if ( vx < m_Min.m_X )
m_Min.m_X = vx;
if ( vy < m_Min.m_Y )
m_Min.m_Y = vy;
if ( vx > m_Max.m_X )
m_Max.m_X = vx;
if ( vy > m_Max.m_Y )
m_Max.m_Y = vy;
m_List[index++] = new MultiTileEntry( (ushort)tile.ID, (short)vx, (short)vy, (short)tile.Z, 1 );
}
}
}
}
开发者ID:Godkong,项目名称:Origins,代码行数:64,代码来源:MultiData.cs
示例8: IsExcludedTile
public override bool IsExcludedTile(StaticTile[] tiles)
{
foreach(StaticTile tile in tiles)
{
if (!IsMastTile(tile))
return false;
}
return true;
}
开发者ID:Ravenwolfe,项目名称:ServUO,代码行数:9,代码来源:BaseGalleon.cs
示例9: Add
public void Add( int itemID, int x, int y, int z )
{
int vx = x + m_Center.m_X;
int vy = y + m_Center.m_Y;
if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height )
{
StaticTile[] oldTiles = m_Tiles[vx][vy];
for ( int i = oldTiles.Length - 1; i >= 0; --i )
{
ItemData data = TileData.ItemTable[itemID & TileData.MaxItemValue];
if ( oldTiles[i].Z == z && (oldTiles[i].Height > 0 == data.Height > 0 ) )
{
bool newIsRoof = ( data.Flags & TileFlag.Roof) != 0;
bool oldIsRoof = (TileData.ItemTable[oldTiles[i].ID & TileData.MaxItemValue].Flags & TileFlag.Roof ) != 0;
if ( newIsRoof == oldIsRoof )
Remove( oldTiles[i].ID, x, y, z );
}
}
oldTiles = m_Tiles[vx][vy];
StaticTile[] newTiles = new StaticTile[oldTiles.Length + 1];
for ( int i = 0; i < oldTiles.Length; ++i )
newTiles[i] = oldTiles[i];
newTiles[oldTiles.Length] = new StaticTile( (ushort)itemID, (sbyte)z );
m_Tiles[vx][vy] = newTiles;
MultiTileEntry[] oldList = m_List;
MultiTileEntry[] newList = new MultiTileEntry[oldList.Length + 1];
for ( int i = 0; i < oldList.Length; ++i )
newList[i] = oldList[i];
newList[oldList.Length] = new MultiTileEntry( (ushort)itemID, (short)x, (short)y, (short)z, 1 );
m_List = newList;
if ( x < m_Min.m_X )
m_Min.m_X = x;
if ( y < m_Min.m_Y )
m_Min.m_Y = y;
if ( x > m_Max.m_X )
m_Max.m_X = x;
if ( y > m_Max.m_Y )
m_Max.m_Y = y;
}
}
开发者ID:Godkong,项目名称:Origins,代码行数:57,代码来源:MultiData.cs
示例10: RemoveXYZH
public void RemoveXYZH( int x, int y, int z, int minHeight )
{
int vx = x + m_Center.m_X;
int vy = y + m_Center.m_Y;
if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height )
{
StaticTile[] oldTiles = m_Tiles[vx][vy];
for ( int i = 0; i < oldTiles.Length; ++i )
{
StaticTile tile = oldTiles[i];
if ( tile.Z == z && tile.Height >= minHeight )
{
StaticTile[] newTiles = new StaticTile[oldTiles.Length - 1];
for ( int j = 0; j < i; ++j )
newTiles[j] = oldTiles[j];
for ( int j = i + 1; j < oldTiles.Length; ++j )
newTiles[j - 1] = oldTiles[j];
m_Tiles[vx][vy] = newTiles;
break;
}
}
MultiTileEntry[] oldList = m_List;
for ( int i = 0; i < oldList.Length; ++i )
{
MultiTileEntry tile = oldList[i];
if ( tile.m_OffsetX == (short)x && tile.m_OffsetY == (short)y && tile.m_OffsetZ == (short)z && TileData.ItemTable[tile.m_ItemID & TileData.MaxItemValue].Height >= minHeight )
{
MultiTileEntry[] newList = new MultiTileEntry[oldList.Length - 1];
for ( int j = 0; j < i; ++j )
newList[j] = oldList[j];
for ( int j = i + 1; j < oldList.Length; ++j )
newList[j - 1] = oldList[j];
m_List = newList;
break;
}
}
}
}
开发者ID:Godkong,项目名称:Origins,代码行数:52,代码来源:MultiData.cs
示例11: MultiComponentList
public MultiComponentList(GenericReader reader)
{
int version = reader.ReadInt();
m_Min = reader.ReadPoint2D();
m_Max = reader.ReadPoint2D();
m_Center = reader.ReadPoint2D();
m_Width = reader.ReadInt();
m_Height = reader.ReadInt();
int length = reader.ReadInt();
var allTiles = m_List = new MultiTileEntry[length];
if (version == 0)
{
for (int i = 0; i < length; ++i)
{
int id = reader.ReadShort();
if (id >= 0x4000)
{
id -= 0x4000;
}
allTiles[i].m_ItemID = (ushort)id;
allTiles[i].m_OffsetX = reader.ReadShort();
allTiles[i].m_OffsetY = reader.ReadShort();
allTiles[i].m_OffsetZ = reader.ReadShort();
allTiles[i].m_Flags = reader.ReadInt();
}
}
else
{
for (int i = 0; i < length; ++i)
{
allTiles[i].m_ItemID = reader.ReadUShort();
allTiles[i].m_OffsetX = reader.ReadShort();
allTiles[i].m_OffsetY = reader.ReadShort();
allTiles[i].m_OffsetZ = reader.ReadShort();
allTiles[i].m_Flags = reader.ReadInt();
}
}
var tiles = new TileList[m_Width][];
m_Tiles = new StaticTile[m_Width][][];
for (int x = 0; x < m_Width; ++x)
{
tiles[x] = new TileList[m_Height];
m_Tiles[x] = new StaticTile[m_Height][];
for (int y = 0; y < m_Height; ++y)
{
tiles[x][y] = new TileList();
}
}
for (int i = 0; i < allTiles.Length; ++i)
{
if (i == 0 || allTiles[i].m_Flags != 0)
{
int xOffset = allTiles[i].m_OffsetX + m_Center.m_X;
int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y;
#region Stygian Abyss
//tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ );
tiles[xOffset][yOffset].Add(
(ushort)((allTiles[i].m_ItemID & TileData.MaxItemValue) | 0x10000), (sbyte)allTiles[i].m_OffsetZ);
#endregion
}
}
for (int x = 0; x < m_Width; ++x)
{
for (int y = 0; y < m_Height; ++y)
{
m_Tiles[x][y] = tiles[x][y].ToArray();
}
}
}
开发者ID:Crome696,项目名称:ServUO,代码行数:80,代码来源:MultiData.cs
示例12: Freeze
//.........这里部分代码省略.........
from.SendGump( new NoticeGump( 1060637, 30720, "No freezable items were found. Only the following item types are frozen:<br> - Static<br> - BaseFloor<br> - BaseWall", 0xFFC000, 320, 240, null, null ) );
return;
}
bool badDataFile = false;
int totalFrozen = 0;
foreach ( DictionaryEntry de in mapTable )
{
Map map = (Map)de.Key;
Hashtable table = (Hashtable)de.Value;
TileMatrix matrix = map.Tiles;
using ( FileStream idxStream = OpenWrite( matrix.IndexStream ) )
{
using ( FileStream mulStream = OpenWrite( matrix.DataStream ) )
{
if ( idxStream == null || mulStream == null )
{
badDataFile = true;
continue;
}
BinaryReader idxReader = new BinaryReader( idxStream );
BinaryWriter idxWriter = new BinaryWriter( idxStream );
BinaryWriter mulWriter = new BinaryWriter( mulStream );
foreach ( DeltaState state in table.Values )
{
int oldTileCount;
StaticTile[] oldTiles = ReadStaticBlock( idxReader, mulStream, state.m_X, state.m_Y, matrix.BlockWidth, matrix.BlockHeight, out oldTileCount );
if ( oldTileCount < 0 )
continue;
int newTileCount = 0;
StaticTile[] newTiles = new StaticTile[state.m_List.Count];
for ( int i = 0; i < state.m_List.Count; ++i )
{
Item item = (Item)state.m_List[i];
int xOffset = item.X - (state.m_X * 8);
int yOffset = item.Y - (state.m_Y * 8);
if ( xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8 )
continue;
StaticTile newTile = new StaticTile();
newTile.m_ID = (short)(item.ItemID & 0x3FFF);
newTile.m_X = (byte)xOffset;
newTile.m_Y = (byte)yOffset;
newTile.m_Z = (sbyte)item.Z;
newTile.m_Hue = (short)item.Hue;
newTiles[newTileCount++] = newTile;
item.Delete();
++totalFrozen;
}
开发者ID:justdanofficial,项目名称:khaeros,代码行数:66,代码来源:Statics.cs
示例13: PatchStatics
private unsafe int PatchStatics( TileMatrix matrix, string dataPath, string indexPath, string lookupPath )
{
using ( FileStream fsData = new FileStream( dataPath, FileMode.Open, FileAccess.Read, FileShare.Read ) )
{
using ( FileStream fsIndex = new FileStream( indexPath, FileMode.Open, FileAccess.Read, FileShare.Read ) )
{
using ( FileStream fsLookup = new FileStream( lookupPath, FileMode.Open, FileAccess.Read, FileShare.Read ) )
{
BinaryReader indexReader = new BinaryReader( fsIndex );
BinaryReader lookupReader = new BinaryReader( fsLookup );
int count = (int)(indexReader.BaseStream.Length / 4);
TileList[][] lists = new TileList[8][];
for ( int x = 0; x < 8; ++x )
{
lists[x] = new TileList[8];
for ( int y = 0; y < 8; ++y )
lists[x][y] = new TileList();
}
for ( int i = 0; i < count; ++i )
{
int blockID = indexReader.ReadInt32();
int blockX = blockID / matrix.BlockHeight;
int blockY = blockID % matrix.BlockHeight;
int offset = lookupReader.ReadInt32();
int length = lookupReader.ReadInt32();
lookupReader.ReadInt32(); // Extra
if ( offset < 0 || length <= 0 )
{
matrix.SetStaticBlock( blockX, blockY, matrix.EmptyStaticBlock );
continue;
}
fsData.Seek( offset, SeekOrigin.Begin );
int tileCount = length / 7;
if ( m_TileBuffer.Length < tileCount )
m_TileBuffer = new StaticTile[tileCount];
StaticTile[] staTiles = m_TileBuffer;
fixed ( StaticTile *pTiles = staTiles )
{
#if !MONO
NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length );
#else
NativeReader.Read( fsData.Handle, pTiles, length );
#endif
StaticTile *pCur = pTiles, pEnd = pTiles + tileCount;
while ( pCur < pEnd )
{
lists[pCur->m_X & 0x7][pCur->m_Y & 0x7].Add( (ushort)pCur->m_ID, pCur->m_Z );
pCur = pCur + 1;
}
StaticTile[][][] tiles = new StaticTile[8][][];
for ( int x = 0; x < 8; ++x )
{
tiles[x] = new StaticTile[8][];
for ( int y = 0; y < 8; ++y )
tiles[x][y] = lists[x][y].ToArray();
}
matrix.SetStaticBlock( blockX, blockY, tiles );
}
}
indexReader.Close();
lookupReader.Close();
return count;
}
}
}
}
开发者ID:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:85,代码来源:TileMatrixPatch.cs
示例14: SetStaticBlock
public void SetStaticBlock( int x, int y, StaticTile[][][] value )
{
if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight )
return;
if ( m_StaticTiles[x] == null )
m_StaticTiles[x] = new StaticTile[m_BlockHeight][][][];
m_StaticTiles[x][y] = value;
if ( m_StaticPatches[x] == null )
m_StaticPatches[x] = new int[(m_BlockHeight + 31) >> 5];
m_StaticPatches[x][y >> 5] |= 1 << (y & 0x1F);
}
开发者ID:Godkong,项目名称:RunUO,代码行数:15,代码来源:TileMatrix.cs
示例15: IsMastTile
public bool IsMastTile(StaticTile tile)
{
int id = tile.ID;
if ((id >= 30150 && id <= 30193) || (id >= 30650 && id <= 30693))
return true;
if ((id >= 30650 && id <= 30693) || (id >= 31150 && id <= 31193))
return true;
if ((id >= 31150 && id <= 31193) || (id >= 31650 && id <= 31693))
return true;
if ((id >= 31840 && id <= 31883) || (id >= 32040 && id <= 32083))
return true;
if ((id >= 32240 && id <= 32283) || (id >= 32440 && id <= 32483))
return true;
if ((id >= 32640 && id <= 32683) || (id >= 32840 && id <= 32883))
return true;
if ((id >= 33040 && id <= 33083) || (id >= 33240 && id <= 33283))
return true;
if ((id >= 23720 && id <= 23740) || (id >= 23742 && id <= 23892))
return true;
if ((id >= 23894 && id <= 23902) || (id >= 23904 && id <= 23935))
return true;
if (id >= 25256 && id <= 25471)
return true;
return false;
}
开发者ID:Ravenwolfe,项目名称:ServUO,代码行数:35,代码来源:BaseGalleon.cs
示例16: TileMatrix
public TileMatrix( Map owner, int fileIndex, int mapID, int width, int height )
{
for ( int i = 0; i < m_Instances.Count; ++i )
{
TileMatrix tm = m_Instances[i];
if ( tm.m_FileIndex == fileIndex )
{
tm.m_FileShare.Add( this );
m_FileShare.Add( tm );
}
}
m_Instances.Add( this );
m_FileIndex = fileIndex;
m_Width = width;
m_Height = height;
m_BlockWidth = width >> 3;
m_BlockHeight = height >> 3;
m_Owner = owner;
if ( fileIndex != 0x7F )
{
string mapPath = Core.FindDataFile( "map{0}.mul", fileIndex );
if ( File.Exists( mapPath ) )
m_Map = new FileStream( mapPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite );
string indexPath = Core.FindDataFile( "staidx{0}.mul", fileIndex );
if ( File.Exists( indexPath ) )
{
m_Index = new FileStream( indexPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite );
m_IndexReader = new BinaryReader( m_Index );
}
string staticsPath = Core.FindDataFile( "statics{0}.mul", fileIndex );
if ( File.Exists( staticsPath ) )
m_Statics = new FileStream( staticsPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite );
}
m_EmptyStaticBlock = new StaticTile[8][][];
for ( int i = 0; i < 8; ++i )
{
m_EmptyStaticBlock[i] = new StaticTile[8][];
for ( int j = 0; j < 8; ++j )
m_EmptyStaticBlock[i][j] = new StaticTile[0];
}
m_InvalidLandBlock = new LandTile[196];
m_LandTiles = new LandTile[m_BlockWidth][][];
m_StaticTiles = new StaticTile[m_BlockWidth][][][][];
m_StaticPatches = new int[m_BlockWidth][];
m_LandPatches = new int[m_BlockWidth][];
m_Patch = new TileMatrixPatch( this, mapID );
}
开发者ID:Godkong,项目名称:RunUO,代码行数:62,代码来源:TileMatrix.cs
示例17: Remove
public void Remove(int itemID, int x, int y, int z)
{
int vx = x + this.m_Center.m_X;
int vy = y + this.m_Center.m_Y;
if (vx >= 0 && vx < this.m_Width && vy >= 0 && vy < this.m_Height)
{
StaticTile[] oldTiles = this.m_Tiles[vx][vy];
for (int i = 0; i < oldTiles.Length; ++i)
{
StaticTile tile = oldTiles[i];
if (tile.ID == itemID && tile.Z == z)
{
StaticTile[] newTiles = new StaticTile[oldTiles.Length - 1];
for (int j = 0; j < i; ++j)
newTiles[j] = oldTiles[j];
for (int j = i + 1; j < oldTiles.Length; ++j)
newTiles[j - 1] = oldTiles[j];
this.m_Tiles[vx][vy] = newTiles;
break;
}
}
MultiTileEntry[] oldList = this.m_List;
for (int i = 0; i < oldList.Length; ++i)
{
MultiTileEntry tile = oldList[i];
if (tile.m_ItemID == itemID && tile.m_OffsetX == (short)x && tile.m_OffsetY == (short)y && tile.m_OffsetZ == (short)z)
{
MultiTileEntry[] newList = new MultiTileEntry[oldList.Length - 1];
for (int j = 0; j < i; ++j)
newList[j] = oldList[j];
for (int j = i + 1; j < oldList.Length; ++j)
newList[j - 1] = oldList[j];
this.m_List = newList;
break;
}
}
}
}
开发者ID:m309,项目名称:ForkUO,代码行数:52,代码来源:MultiData.cs
示例18: IsExcludedTile
public virtual bool IsExcludedTile(StaticTile[] tile)
{
return false;
}
开发者ID:Crome696,项目名称:ServUO,代码行数:4,代码来源:BaseBoat.cs
示例19: IsVizBlockingInvalidLand
//--------------------------------------------------------------------------
// Is this an invalid tile which also blocks vix?
//--------------------------------------------------------------------------
public bool IsVizBlockingInvalidLand( LandTile landTile, StaticTile[] staticTiles, int x, int y )
{
if( IsInvalidLandTile( landTile ) )
{
if( staticTiles.Length == 0 )
{
if( !ContainsVisibleItem( x, y ) )
{
return true;
}
}
}
return false;
}
开发者ID:ITLongwell,项目名称:Ulmeta,代码行数:18,代码来源:LOS.cs
示例20: TileBlocksVis
//--------------------------------------------------------------------------
// Does a tile block my vision?
//--------------------------------------------------------------------------
public bool TileBlocksVis( StaticTile tile, int eyelevel, int x, int y, Point3D beholder )
{
ItemData data = TileData.ItemTable[tile.ID & 0x3FFF];
int height = data.CalcHeight;
int windowRange = LOS.Config.GetInstance().WindowRange;
//----------------------------------------------------------------------
// tiles starting higher than eyelevel don't block LOS
//----------------------------------------------------------------------
if( tile.Z > eyelevel ) return false;
//----------------------------------------------------------------------
// whitelisted tils dont block vis
//----------------------------------------------------------------------
if( Config.GetInstance().WhiteListed( tile.ID ) ) return false;
//----------------------------------------------------------------------
// Windows
//----------------------------------------------------------------------
if (
// Some tiles are windows but not flagged properly; we can tell by the name
( data.Flags & TileFlag.Window ) != 0
||
data.Name == "window"
)
{
if( windowRange > 0 )
{
if( Utility.InRange( new Point3D( x, y, 0 ), beholder, windowRange ) ) return false;
else return true;
}
else return false;
}
//----------------------------------------------------------------------
// Trees
//----------------------------------------------------------------------
if( Config.GetInstance().Tree( tile.ID ))
{
int treeRange = LOS.Config.GetInstance().TreeRange;
if( treeRange > 0 )
{
if( Utility.InRange( new Point3D( x, y, 0), beholder, treeRange ) ) return false;
else return true;
}
else return false;
}
//----------------------------------------------------------------------
// Walls
//----------------------------------------------------------------------
bool tallEnough = tile.Z + height >= eyelevel;
if( ( data.Flags & TileFlag.Wall ) != 0 )
{
//------------------------------------------------------------------
// high walls: walls that block LOS regardless of player Z
//------------------------------------------------------------------
if( Config.GetInstance().HighWalls )
{
// solid-wall
if( ( data.Flags & TileFlag.NoShoot ) != 0 )
{
if( Utility.InRange( new Point3D( x, y, 0), beholder, Config.GetInstance().EdgeRange ) )
{
if( tallEnough ) return true;
else return false;
}
return true;
}
// window-wall
else
{
if( !tallEnough ) return false; // window walls never infinitely high
if( windowRange > 0 )
{
if( Utility.InRange( new Point3D( x, y, 0 ), beholder, windowRange ) ) return false;
else return true;
}
else return false;
}
}
//------------------------------------------------------------------
// ordinary walls
//------------------------------------------------------------------
else
{
if( !tallEnough ) return false;
//.........这里部分代码省略.........
开发者ID:ITLongwell,项目名称:Ulmeta,代码行数:101,代码来源:LOS.cs
注:本文中的Server.StaticTile类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论