public void Update() { tempMario = (IMario)WorldManager.ReturnPlayer(); if(updateDelay == IGameStateConstants.UPDATEDELAY){ if (slidingDownPole){ tempMario.MarioState.PoleSlide(); tempMario.Physics.Velocity = new Vector2(0, IGameStateConstants.POLESLIDEVELOCITY); if (tempMario.VectorCoordinates.Y > IGameStateConstants.ENDPOLESLIDECOORDINATE) { slidingDownPole = false; tempMario.MarioState.FlipAroundPole(); } } else if (timer >= IGameStateConstants.FLAGPOLESTATETIMERJUMPMIN && timer < IGameStateConstants.FLAGPOLESTATETIMERJUMPMAX && !(hasJumpedOffPole)) { tempMario.MarioState.Jump(); tempMario.Physics.Velocity = new Vector2(IGameStateConstants.FLAGPOLESTATEMARIOJUMPXVELOCITY, IGameStateConstants.FLAGPOLESTATEMARIOJUMPYVELOCITY); if ((tempMario.VectorCoordinates.Y + tempMario.Sprite.SpriteDimensions.Y) > IGameStateConstants.FLAGPOLESTATEMARIOHASJUMPEDYCOORDINATE) { hasJumpedOffPole = true; tempMario.MarioState.FlipAroundPole(); } } else if (hasJumpedOffPole && !(slidingDownPole) && !(hasWalkedIntoCastle)) { tempMario.Physics.Velocity = new Vector2(IGameStateConstants.FLAGPOLESTATEMARIOWALKINGTOWARDSCASTLEXVELOCITY, 0); tempMario.Physics.Acceleration = new Vector2(0, 0); if (tempMario.VectorCoordinates.X >= IGameStateConstants.FLAGPOLESTATECASTLEDOORXCOORDINATE) { hasWalkedIntoCastle = true; tempMario.Physics.Velocity = new Vector2(0, 0); tempMario.Physics.Acceleration = new Vector2(0, 0); } if (!haveAddedTimePoints) { ScoreManager.HandleRemainingTime(); HUDManager.SetTimeToZero(); haveAddedTimePoints = true; } } else if (hasJumpedOffPole && !(slidingDownPole) && hasWalkedIntoCastle) { tempMario.ToIdle(); tempMario.Physics.Velocity = new Vector2(0, 0); tempMario.Physics.Acceleration = new Vector2(0, 0); int victoryWaitTimer = IGameStateConstants.FLAGPOLESTATEVICTORYWAITTIMER; while (victoryWaitTimer > 0) victoryWaitTimer--; game.gameState = new VictoryScreenGameState(game); game.gameState.LoadContent(); } updateDelay = 0; WorldManager.Update(camera); CollisionManager.Update(this); camera.Update(tempMario); } foreach (IController controller in controllerList) controller.Update(); timer++; updateDelay++; }