public FingerGames() { _instance = this; _graphics = new GraphicsDeviceManager(this); _graphics.IsFullScreen = true; Content.RootDirectory = "Content"; // Frame rate is 30 fps by default for Windows Phone. TargetElapsedTime = TimeSpan.FromTicks(333333); _gameStages.Add(Stage.InGame, new InGameStage(this)); _gameStages.Add(Stage.Intro, new IntroStage(this)); _gameStages.Add(Stage.SelectGame, new SelectGameStage(this)); _gameStages.Add(Stage.Trial, new TrialStage(this)); _gameStages.Add(Stage.Help, new HelpStage(this)); _activeStage = _gameStages[Stage.Intro]; _gameManager = new GameManager(GetWindowsLiveAnonymousID(), this, new GamePlayer[] { new GamePlayer(0, "Default") }); }
public FingerGames() { _instance = this; _graphics = new GraphicsDeviceManager(this); _graphics.IsFullScreen = true; Content.RootDirectory = "Content"; // Frame rate is 30 fps by default for Windows Phone. TargetElapsedTime = TimeSpan.FromTicks(333333); _gameStages.Add(Stage.InGame, new InGameStage(this)); _gameStages.Add(Stage.Intro, new IntroStage(this)); _gameStages.Add(Stage.SelectGame, new SelectGameStage(this)); _gameStages.Add(Stage.Trial, new TrialStage(this)); _gameStages.Add(Stage.Help, new HelpStage(this)); _activeStage = _gameStages[Stage.Intro]; _gameManager = new GameManager(GetWindowsLiveAnonymousID(), this, new GamePlayer[] { new GamePlayer(0, "Default") }); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (!_isKeyboardShown) { _isKeyboardShown = true; if (string.IsNullOrEmpty(Settings.Instance.GamerTag)) { Guide.BeginShowKeyboardInput(PlayerIndex.One, "Enter Your High Score Name", "Please enter the name you want used for high scores.", "", new AsyncCallback(KeyboardComplete), null); } } if (!_isTransitioning) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { if (_activeStage.HandleBackClick()) { // } else { GoBack(); } } _activeStage.Update(gameTime); } else { if (_transitionCount == _halfTransitionLength) { _activeStage.Deactivate(); _activeStage = _gameStages[_newStage]; _activeStage.Activate(); _activeStage.Update(gameTime); } else if (_transitionCount > _halfTransitionLength) { _transitionOpacity = (byte)(0xff - ((_transitionCount - _halfTransitionLength) * (0xff / (float)_halfTransitionLength))); } else { _transitionOpacity = (byte)(((_transitionCount) * (0xff / (float)_halfTransitionLength))); } if (_transitionCount <= 0) { _isTransitioning = false; } _transitionCount--; } base.Update(gameTime); if (iterCount++ == 40) { iterCount = 0; for (int i = 0; i < _orbNext.Length; ++i) { _orbNext[i].X = Randomizer.Next(-80, 80); _orbNext[i].Y = Randomizer.Next(-80, 80); } } offset.X = float.MaxValue; offset.Y = float.MaxValue; for (int i = 0; i < _orbNext.Length; ++i) { //_orbSpots[i].X = (float)Math.Max(0, Math.Min(800, _orbSpots[i].X + _orbNext[i].X / 40)); //_orbSpots[i].Y = (float)Math.Max(0, Math.Min(480, _orbSpots[i].Y + _orbNext[i].Y / 40)); offset.X = Math.Min(offset.X, _orbSpots[i].X); offset.Y = Math.Min(offset.Y, _orbSpots[i].Y); } return; }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (!_isKeyboardShown) { _isKeyboardShown = true; if (string.IsNullOrEmpty(Settings.Instance.GamerTag)) { Guide.BeginShowKeyboardInput(PlayerIndex.One, "Enter Your High Score Name", "Please enter the name you want used for high scores.", "", new AsyncCallback(KeyboardComplete), null); } } if (!_isTransitioning) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { if (_activeStage.HandleBackClick()) { // } else { GoBack(); } } _activeStage.Update(gameTime); } else { if (_transitionCount == _halfTransitionLength) { _activeStage.Deactivate(); _activeStage = _gameStages[_newStage]; _activeStage.Activate(); _activeStage.Update(gameTime); } else if (_transitionCount > _halfTransitionLength) { _transitionOpacity = (byte)(0xff - ((_transitionCount - _halfTransitionLength) * (0xff / (float)_halfTransitionLength))); } else { _transitionOpacity = (byte)(((_transitionCount) * (0xff / (float)_halfTransitionLength))); } if (_transitionCount <= 0) { _isTransitioning = false; } _transitionCount--; } base.Update(gameTime); if (iterCount++ == 40) { iterCount = 0; for (int i = 0; i < _orbNext.Length; ++i) { _orbNext[i].X = Randomizer.Next(-80, 80); _orbNext[i].Y = Randomizer.Next(-80, 80); } } offset.X = float.MaxValue; offset.Y = float.MaxValue; for (int i = 0; i < _orbNext.Length; ++i) { //_orbSpots[i].X = (float)Math.Max(0, Math.Min(800, _orbSpots[i].X + _orbNext[i].X / 40)); //_orbSpots[i].Y = (float)Math.Max(0, Math.Min(480, _orbSpots[i].Y + _orbNext[i].Y / 40)); offset.X = Math.Min(offset.X, _orbSpots[i].X); offset.Y = Math.Min(offset.Y, _orbSpots[i].Y); } return; }