/// <summary> /// Method that is called when pea jumps /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _source_OnJumpStarted(JumpEventArgs e) { // Because the controler is created BEFORE the sprites this works if (e.Pea.IsAlive && !e.Pea.IsNotHappy && e.Pea.JumpSpot != null) { _activeState = new SpriteJumpInfo(this.SceneLayer, _pointsController.ActiveTimes(e.Pea)); _activeState.Initialize(); if (this.ContentManager != null) _activeState.LoadContent(this.ContentManager); } }
/// <summary> /// Frame Renewal /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { base.Update(gameTime); base.Position = _source.Position; this.Rotation = _source.Rotation; if (_source.IsAlive == false) { if (_source.IsDying) { this.Color = Color.Lerp(this.Color, Color.Transparent, (Single)gameTime.ElapsedGameTime.TotalSeconds * 15); } else { this.Color = Color.Lerp(this.Color, Color.White, (Single)gameTime.ElapsedGameTime.TotalSeconds * 5); } this.Rotation = 0; // (Single)MathHelper.Lerp(this.Rotation, 0, (Single)gameTime.ElapsedGameTime.TotalSeconds * 10); } else { this.Color = Color.Lerp(this.Color, Color.White, (Single)gameTime.ElapsedGameTime.TotalSeconds * 5); } // TODO rotation smoothing //var degrees = Math.Round(this.Rotation * 180 / Math.PI, 1); //this.Rotation = (Single)(degrees * Math.PI / 180); if (_alert != null) { _alert.Update(gameTime); _alert.Position = this.Position; if (_alert.Enabled == false) { _alert = null; } } if (_activeState != null) { _activeState.Update(gameTime); _activeState.Position = this.Position; _activeState.Visible = true; //Settings.Get.ShowJumpInfo; if (_activeState.Enabled == false) { _activeState = null; } } }
/// <summary> /// Method that is called when pea jumps /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _source_OnJumpStarted(JumpEventArgs e) { // Because the controler is created BEFORE the sprites this works if (e.Pea.IsAlive && !e.Pea.IsNotHappy && e.Pea.JumpSpot != null) { _activeState = new SpriteJumpInfo(this.SceneLayer, _pointsController.ActiveTimes(e.Pea)); _activeState.Initialize(); if (this.ContentManager != null) { _activeState.LoadContent(this.ContentManager); } } }
/// <summary> /// Frame Renewal /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { base.Update(gameTime); base.Position = _source.Position; this.Rotation = _source.Rotation; if (_source.IsAlive == false) { if (_source.IsDying) this.Color = Color.Lerp(this.Color, Color.Transparent, (Single)gameTime.ElapsedGameTime.TotalSeconds * 15); else this.Color = Color.Lerp(this.Color, Color.White, (Single)gameTime.ElapsedGameTime.TotalSeconds * 5); this.Rotation = 0; // (Single)MathHelper.Lerp(this.Rotation, 0, (Single)gameTime.ElapsedGameTime.TotalSeconds * 10); } else { this.Color = Color.Lerp(this.Color, Color.White, (Single)gameTime.ElapsedGameTime.TotalSeconds * 5); } // TODO rotation smoothing //var degrees = Math.Round(this.Rotation * 180 / Math.PI, 1); //this.Rotation = (Single)(degrees * Math.PI / 180); if (_alert != null) { _alert.Update(gameTime); _alert.Position = this.Position; if (_alert.Enabled == false) _alert = null; } if (_activeState != null) { _activeState.Update(gameTime); _activeState.Position = this.Position; _activeState.Visible = true; //Settings.Get.ShowJumpInfo; if (_activeState.Enabled == false) _activeState = null; } }