public static void ReplaceHotBarWithMiddleMouse(TileHolder tileHolder, TileType newId) { _deletedTile = new TileHolder(tileHolder.Id); _deletedTile.SetPosition(tileHolder.GetPosition()); _deletedTile.MoveTo(new Vector2(_deletedTile.GetPosition().X, -_deletedTile.DrawRectangle.Height), 200); tileHolder.ChangeId(newId); tileHolder.SetPosition(tileHolder.GetPosition().X, -tileHolder.DrawRectangle.Height); tileHolder.ReturnToDefaultPosition(); _swipeSound.Play(); }
/// <summary> /// Replace the tile in the hot bar with the tile hovered above it. /// </summary> /// <param name="tileHolder"></param> public static void ReplaceHotBar(TileHolder tileHolder) { for (int i = 0; i < _tileHolders.Count; i++) { if (tileHolder.IsIntersectingWithSlotOf(_tileHolders[i])) { // It's all an optical illusion. The tile in the hot bar replaces the tile being moved, and a temporary tile is created to animate the deletion of the tile in the hotbar. _deletedTile = new TileHolder(_tileHolders[i].Id); _deletedTile.SetPosition(_tileHolders[i].GetPosition()); _deletedTile.MoveTo(new Vector2(_deletedTile.GetPosition().X, -_deletedTile.DrawRectangle.Height), 200); _tileHolders[i].ChangeId(tileHolder.Id); _tileHolders[i].SetPosition(tileHolder.GetPosition()); _tileHolders[i].ReturnToDefaultPosition(); tileHolder.SetPosition(TMBAW_Game.UserResWidth, TMBAW_Game.UserResHeight); tileHolder.ReturnToDefaultPosition(500); _swipeSound.Play(); _replaceSound.Play(); return; } } TileHolder.ReturnSound.Play(); }