public static void MoveTo(OnTileObject onTileObject, Tile newTile, bool adjustPosition = true) { if (newTile == null) { return; } if (onTileObject == null) { return; } if (onTileObject.Tile == null) { return; } if (onTileObject.Tile == newTile) { return; } onTileObject.Tile.RemoveOnTileObject(onTileObject); newTile.AddOnTileObject(onTileObject, adjustPosition); }
public void TestInitialize(int col, int row, OnTileObject groundPrefab, OnTileObject wallPrefab) { Vector3 origin = transform.position; _tiles = new Tile[col, row]; for (int y = 0; y < row; y++) { for (int x = 0; x < col; x++) { Vector3 position = origin + new Vector3(x, y) * _tileSize; var tile = Instantiate(_tilePrefab, position, transform.rotation); tile.transform.parent = transform; _tiles[x, y] = tile; tile.Initialize(this, x, y); var prefab = Random.value > 0.2 ? groundPrefab : wallPrefab; var onTileObject = Instantiate(prefab, tile.transform); tile.AddOnTileObject(onTileObject); } } }
public virtual void OnOtherExit(OnTileObject other) { }
public virtual void OnOtherEnter(OnTileObject other) { }