public override void Draw(Graphics2D g) { g.ResetTranslation(); // Draw the room. if (isBeginningFade) { OldRoomControl.Draw(g); } else { NewRoomControl.Draw(g); } // Draw the fade. int t = timer; int delay = TRANSITION_SWITCH_FADE_DELAY / 2; if (!isBeginningFade) { t = (TRANSITION_FADE_DURATION - delay) - t; } float opacity = t / (float)(TRANSITION_FADE_DURATION - delay); opacity = GMath.Clamp(opacity, 0.0f, 1.0f); g.FillRectangle(GameSettings.SCREEN_BOUNDS, fadeColor * opacity); }
//----------------------------------------------------------------------------- // Internal drawing //----------------------------------------------------------------------------- private void DrawRooms(Graphics2D g) { // Determine room draw positions. Point2I panOld = Directions.ToPoint(direction) * (-distance); Point2I panNew = Directions.ToPoint(direction) * (GameSettings.VIEW_SIZE - distance); // Draw the old and new rooms. OldRoomControl.DrawRoom(g, new Vector2F(0, 16) + panOld); NewRoomControl.DrawRoom(g, new Vector2F(0, 16) + panNew); }
protected void SetupNewRoom() { OldRoomControl.Entities.Remove(Player); NewRoomControl.BeginRoom(); Player.RoomControl = NewRoomControl; if (eventSetupNewRoom != null) { eventSetupNewRoom.Invoke(roomNew); } NewRoomControl.ViewControl.CenterOn(Player.Center + Player.ViewFocusOffset); }
public override void Draw(Graphics2D g) { g.ResetTranslation(); if (timer < TRANSITION_SPLIT_BEGIN_DELAY) { OldRoomControl.Draw(g); } else { NewRoomControl.Draw(g); g.ResetTranslation(); g.Translate(0, 16); g.FillRectangle(new Rectangle2F(0, 0, sideWidths[0], GameSettings.VIEW_HEIGHT), splitColor); g.FillRectangle(new Rectangle2F(GameSettings.VIEW_WIDTH - sideWidths[1], 0, sideWidths[1], GameSettings.VIEW_HEIGHT), splitColor); } }