LynnaLab.TilesetHeaderGroup.GetCollisionsData C# (CSharp) Method

GetCollisionsData() public method

public GetCollisionsData ( int i ) : byte
i int
return byte
        public byte GetCollisionsData(int i)
        {
            if (collisionsDataFile == null)
                throw new Exception("Tileset header group 0x" + Index.ToString("X") + " does not reference collision data.");
            collisionsDataFile.Seek(i, SeekOrigin.Begin);
            return (byte)collisionsDataFile.ReadByte();
        }

Usage Example

示例#1
0
        // Get the "basic collision" of a subtile (whether or not that part is
        // solid). This ignores the upper half of the collision data bytes and
        // assumes it is zero.
        public bool GetSubTileBasicCollision(int index, int x, int y)
        {
            byte b = tilesetHeaderGroup.GetCollisionsData(index);
            byte i = (byte)(1 << (3 - (x + y * 2)));

            return((b & i) != 0);
        }