protected override void OnUpdate(GDGameScreen screen, SAMTime gameTime, InputState istate) { if (_state >= TutorialState.TargetFirstNeutral) { _cannon1.CannonHealth.SetForce(1); } if (_state >= TutorialState.TargetCenter) { _cannon2.CannonHealth.SetForce(1); } if (_state >= TutorialState.AttackEnemy) { _cannon3.CannonHealth.SetForce(1); } _s1_blinkTimer += gameTime.ElapsedSeconds; switch (_state) { case TutorialState.Start: Transition_1_ShootFirstNeutral(); break; case TutorialState.TargetFirstNeutral: if (_cannon2.Fraction != _fracNeutral) { _cannon2.CannonHealth.SetForce(0f); _cannon2.SetFraction(_fracNeutral); } _infobox.Background = _infobox.Background.WithColor(ColorMath.Blend(FlatColors.Concrete, FlatColors.Orange, FloatMath.PercSin(_s1_blinkTimer * 4f))); if (FloatMath.DiffRadiansAbs(_cannon1.Rotation.ActualValue, FloatMath.RAD_POS_270) < FloatMath.RAD_POS_060) { Transition_2_ShootingFirstNeutral(); } break; case TutorialState.ShootingFirstNeutral: _infobox.Background = _infobox.Background.WithColor(FlatColors.Concrete); if (FloatMath.IsOne(_cannon2.CannonHealth.ActualValue)) { Transition_3_TargetCenter(); } break; case TutorialState.TargetCenter: if (FloatMath.DiffRadiansAbs(_cannon2.Rotation.ActualValue, FloatMath.RAD_000) < FloatMath.RAD_POS_060) { Transition_4_BoostWhileShootingCenter(); } break; case TutorialState.BoostWhileShootingCenter: _cannon3.ForceResetBarrelCharge(); // no shooting enemy for now _cannon4.ForceResetBarrelCharge(); // no shooting me for now _cannon3.Rotation.Set(FloatMath.RAD_POS_090); var cap3 = _cannon3.Fraction == _fracPlayer && FloatMath.IsOne(_cannon3.CannonHealth.ActualValue); var cap4 = _cannon4.Fraction == _fracComputer && FloatMath.IsOne(_cannon4.CannonHealth.ActualValue); if (cap3 && _cannon4.Fraction == _fracComputer) { _cannon4.CannonHealth.Set(1); } if (cap3 && cap4) { Transition_5_AttackEnemy(); } break; case TutorialState.AttackEnemy: _cannon4.CannonHealth.SetForce(1); if (FloatMath.DiffRadiansAbs(_cannon3.Rotation.ActualValue, FloatMath.RAD_000) < FloatMath.RAD_POS_060) { Transition_6_ChangeGameSpeed(); } break; case TutorialState.ChangeGameSpeed: _cannon4.CannonHealth.SetForce(1); if (_screen.GameSpeedMode > GameSpeedModes.SUPERSLOW) { Transition_7_CaptureEnemy(); } break; case TutorialState.CaptureEnemy: _infobox.Background = _infobox.Background.WithColor(ColorMath.Blend(FlatColors.Alizarin, FlatColors.SunFlower, FloatMath.PercSin(_s1_blinkTimer * 6f))); if (FloatMath.IsOne(_cannon4.CannonHealth.ActualValue) && _cannon4.Fraction == _fracPlayer) { Transition_8_WinGame(); } break; case TutorialState.WinGame: _infobox.Background = _infobox.Background.WithColor(ColorMath.Blend(FlatColors.Emerald, FlatColors.Concrete, FloatMath.PercSin(_s1_blinkTimer * 4f))); break; default: throw new ArgumentOutOfRangeException(); } }