コード例 #1
0
        private void HandleTurfUpdate(NetIncomingMessage message)
        {
            float     x       = message.ReadFloat();
            float     y       = message.ReadFloat();
            string    tileStr = GetTileString(message.ReadByte());
            var       state   = (TileState)message.ReadByte();
            Direction dir     = Direction.North;

            if (tileStr == "Wall")
            {
                dir = (Direction)message.ReadByte();
            }

            Tile t = (Tile)GetTypeAt(tileStr, new Vector2D(x, y));

            if (t != null && t._dir == dir)
            {
                RemoveTile(t);
                if (t.GetType().GetInterface("ICollidable") != null)
                {
                    _collisionManager.RemoveCollidable((ICollidable)t);
                }
            }
            t = GenerateNewTile(tileStr, state, new Vector2D(x, y), dir);
            AddTile(t);
            t.SetSprite();
            TileChanged(t);
        }