/// <summary> /// Fires when a pea completed jump (or is trapped) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pea_OnJumpCompleted(JumpEventArgs e) { // Check if actual jump if (e.Spot == null) { return; } // Pea Died if (!e.Pea.IsAlive) { Check(Achievement.Identifier.FirstDeath); Modify(Achievement.Identifier.NoDeaths, __Increment); Progress(Achievement.Identifier.AllDeath, __CheckAllPeaIn, (h) => __AddAndReturn <DataPea>(h, e.Pea)); } // Pea Trapped else if (e.Pea.IsTrapped) { Check(Achievement.Identifier.FirstTrap); Modify(Achievement.Identifier.NoTraps, __Increment); } // Flag completed if ((e.Spot.Completion + e.Spot.FailFloat) >= 1.0f) { Check(Achievement.Identifier.FirstCompletion); Check(Achievement.Identifier.FirstHappyFlag, (a) => __IsLessThanOrEqual(e.Spot.FailFloat, 0.05)); Check(Achievement.Identifier.FirstDeathFlag, (a) => __IsMoreThanOrEqual(e.Spot.FailFloat, 0.95)); } Modify(Achievement.Identifier.AllJumping, (h) => __RemoveAndReturn <DataPea>(h, e.Pea)); _jumpDisabled[e.Pea].Clear(); }
/// <summary> /// Fires when a pea jumps /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pea_OnJumpStarted(JumpEventArgs e) { // Check if actual jump if (e.Spot == null) { return; } Check(Achievement.Identifier.FirstJump); Progress(Achievement.Identifier.AllJumping, __CheckAllPeaInAndUniqueSpot, (h) => __AddAndReturn <DataPea>(h, e.Pea)); }
/// <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> /// Runs when jump is completed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pea_OnJumpCompleted(JumpEventArgs e) { // Update score foreach (var state in _active.FindAll(a => a.Pea == e.Pea)) { if (!state.Pea.IsNotHappy && !state.Pea.IsTrapped && state.Pea.IsAlive) // last check shouldn't be needed { this.PlayingScore += state.Points; } } // multiplier //(Int32)Math.Ceiling(state.Pea.JumpSpot.Completion * DataJumpSpot.MaxCompletion); _active.RemoveAll(a => a.Pea == e.Pea); }
/// <summary> /// Runs when jump is completed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pea_OnJumpCompleted(JumpEventArgs e) { // Update score foreach (var state in _active.Where(a => a.Pea == e.Pea)) if (!state.Pea.IsNotHappy && !state.Pea.IsTrapped && state.Pea.IsAlive) // last check shouldn't be needed { this.PlayingScore += state.Points; PlayerProgress.Current.Points(state.Points); } // multiplier //(Int32)Math.Ceiling(state.Pea.JumpSpot.Completion * DataJumpSpot.MaxCompletion); _active.RemoveAll(a => a.Pea == e.Pea); }
/// <summary> /// Runs when jump is failed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pea_OnJumpFailed(JumpEventArgs e) { _active.RemoveAll(a => a.Pea == e.Pea); }
/// <summary> /// Runs when jump is started /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pea_OnJumpStarted(JumpEventArgs e) { _active.Add(new PointsControllerState(e.Pea)); }
/// <summary> /// Method that is called when a pea finishes jumping /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _source_OnJumpCompleted(JumpEventArgs e) { if (_activeState != null) _activeState.Exit(); if (!e.Pea.IsAlive) return; if (e.Pea.IsTrapped) _alert = SpriteAlert.GenerateTrap(this.SceneLayer); else if (!e.Pea.IsNotHappy) _alert = SpriteAlert.GenerateNinja(this.SceneLayer); if (_alert != null) { _alert.Initialize(); if (this.ContentManager != null) _alert.LoadContent(this.ContentManager); } }
/// <summary> /// Runs when jump is failed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pea_OnJumpFailed(JumpEventArgs e) { _active.RemoveAll(a => a.Pea == e.Pea); }
/// <summary> /// Runs when jump is started /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pea_OnJumpStarted(JumpEventArgs e) { _active.Add(new PointsControllerState(e.Pea)); }