Exemple #1
0
        /// <summary>
        /// Sets the tile at a certain point in the region, removing and disposing of information
        /// pertaining to the old tile.
        /// </summary>
        /// <param name="x">The x-coordinate to set.</param>
        /// <param name="y">The y-coordinate to set.</param>
        /// <param name="t">The tile to set the point (x, y) to.</param>
        public void SetTile(int x, int y, Tile t)
        {
            if (t == null)
                Debug.Throw(new ArgumentNullException("t"));

            SetTile(x, y, t.TileId);
        }
Exemple #2
0
 /// <summary>
 /// Sets the tile at a certain point in the region, removing and disposing of information
 /// pertaining to the old tile. Unchecked and faster.
 /// </summary>
 /// <param name="x">The x-coordinate to set.</param>
 /// <param name="y">The y-coordinate to set.</param>
 /// <param name="t">The tile to set the point (x, y) to.</param>
 public void SetTile_(int x, int y, Tile t)
 {
     SetTile_(x, y, t.TileId);
 }
Exemple #3
0
 /// <summary>
 /// Sets the tile at the given location.
 /// </summary>
 /// <param name="x">The x-coordinate to set.</param>
 /// <param name="y">The y-coordinate to set.</param>
 /// <param name="z">The z-level to set the tile at.</param>
 /// <param name="t">The tile to set the world location to.</param>
 public void SetTile(int x, int y, int z, Tile t)
 {
     SetTile(x, y, z, t.TileId);
 }
Exemple #4
0
 /// <summary>
 /// Called when the tile is placed in the world, and before the adjacent tiles get OnAdjacentChange called.
 /// </summary>
 /// <param name="x">The x-coordinate of the new tile.</param>
 /// <param name="y">The y-coordinate of the new tile.</param>
 /// <param name="z">The z-level of the new tile.</param>
 /// <param name="oldtile">The tile that inhabited the spot before the change.</param>
 /// <param name="oldmeta">The metadata of the tile that inhabited the spot before hand.</param>
 public virtual void OnPlaced(int x, int y, int z, Tile oldtile, byte oldmeta)
 {
 }
Exemple #5
0
 /// <summary>
 /// Called when an adjacent tile is changed from one tile type to another.
 /// </summary>
 /// <param name="x">The x-coordinate of the current tile.</param>
 /// <param name="y">The y-coordinate of the current tile.</param>
 /// <param name="z">The z-level of the tiles.</param>
 /// <param name="nx">The x-coordinate of the tile that changed.</param>
 /// <param name="ny">The y-coordinate of the tile that changed.</param>
 /// <param name="dir">The direction from the current tile to the tile that changed.</param>
 /// <param name="oldTile">The changed tile's old tile type.</param>
 /// <param name="newTile">The changed tile's new tile type.</param>
 public virtual void OnAdjacentChange(int x, int y, int z, int nx, int ny, WorldDirection dir, Tile oldTile, Tile newTile)
 {
 }
 public DuplicateTileException(Tile ot, Tile nt)
 {
     OriginalTile = ot;
     NewTile = nt;
 }
        /// <summary>
        /// Register a new tile type and instance with the registry for use in the game. Will
        /// throw an exception if the tile was already registered, or if the id is already
        /// taken.
        /// </summary>
        /// <param name="tile">The tile instance (and type) to register.</param>
        public static void RegisterTile(Tile tile)
        {
            if (tile == null)
                Debug.Throw(new ArgumentNullException("tile", "Cannot register a null tile."));

            if (registeredTiles[tile.TileId] != null)
                Debug.Throw(new DuplicateTileException(registeredTiles[tile.TileId], tile));

            tile.IsServer = SSCore.IsServer;

            registeredTiles[tile.TileId] = tile;
            Debug.LogSys("Registered a new tile [" + tile.GetType() + "] (" + tile.TileId + ").");
        }