public void Increment(ITotal with) { PointTotal other = (PointTotal)with; this.points += other.points; this.goalaverage += other.goalaverage; }
public int CompareTo(object obj) { PointTotal other = (PointTotal)obj; return(this.points != other.points ? this.points - other.points : this.goalaverage - other.goalaverage); }
public override void Update(GameTime gameTime) { switch (CurrentState) { case ScreenState.HOUSE: SetTransitionTimeIfZero(gameTime, 1000); if (gameTime.TotalGameTime.TotalMilliseconds > TransitionTime.TotalMilliseconds) { TransitionTime = TimeSpan.Zero; CurrentState = ScreenState.CAR; } break; case ScreenState.CAR: if (CarPosition == Vector2.Zero) { TransitionTime = TimeSpan.Zero; CurrentState = ScreenState.BUBBLE; } UpdateCar(gameTime); break; case ScreenState.BUBBLE: SetTransitionTimeIfZero(gameTime, 1000); if (gameTime.TotalGameTime.TotalMilliseconds > TransitionTime.TotalMilliseconds) { TransitionTime = TimeSpan.Zero; CurrentState = ScreenState.ADD; } break; case ScreenState.ADD: SetTransitionTimeIfZero(gameTime, 50); if (TempScore >= TheLastSliceGame.Instance.Player.Score) { TransitionTime = TimeSpan.Zero; CurrentState = ScreenState.WAIT; } int addToScore = 20; if (TheLastSliceGame.Instance.Player.Score > 5000) { addToScore = 250; } TempScore = Math.Min(TempScore += addToScore, TheLastSliceGame.Instance.Player.Score); if (TempScore < TheLastSliceGame.Instance.Player.Score && gameTime.TotalGameTime.TotalMilliseconds > TransitionTime.TotalMilliseconds) { PointTotal.Play(); TransitionTime = TimeSpan.FromMilliseconds(gameTime.TotalGameTime.TotalMilliseconds + 50); } break; case ScreenState.WAIT: if (TransitionTime == TimeSpan.Zero) { TransitionTime = TimeSpan.FromMilliseconds(gameTime.TotalGameTime.TotalMilliseconds + 2000); } if (gameTime.TotalGameTime.TotalMilliseconds > TransitionTime.TotalMilliseconds) { TransitionTime = TimeSpan.Zero; if (TheLastSliceGame.LevelManager.CurrentLevelNum - 1 >= TheLastSliceGame.LevelManager.Levels.Count) { //Game over sucka TheLastSliceGame.Instance.GameOver(GameOverReason.Win); } else { TheLastSliceGame.Instance.ChangeState(GameState.Game); } } break; } }