public static IEnumerator CustomFeatherCoroutine() { Player player = FrostModule.StateGetPlayer(); DynData <Player> data = new DynData <Player>(player); CustomFeather feather = (CustomFeather)data["fh.customFeather"]; while (player.Sprite.CurrentAnimationID == "startStarFly") { yield return(null); } while (player.Speed != Vector2.Zero) { yield return(null); } yield return(0.1f); player.Sprite.Color = feather.FlyColor; player.Sprite.HairCount = 7; player.Hair.DrawPlayerSpriteOutline = true; player.SceneAs <Level>().Displacement.AddBurst(player.Center, 0.25f, 8f, 32f, 1f, null, null); data["starFlyTransforming"] = false; data["starFlyTimer"] = feather.FlyTime; player.RefillDash(); player.RefillStamina(); Vector2 dir = Input.Aim.Value; bool flag = dir == Vector2.Zero; if (flag) { dir = Vector2.UnitX * (float)player.Facing; } player.Speed = dir * 250f; data["starFlyLastDir"] = dir; player.SceneAs <Level>().Particles.Emit(feather.P_Boost, 12, player.Center, Vector2.One * 4f, feather.FlyColor, (-dir).Angle()); Input.Rumble(RumbleStrength.Strong, RumbleLength.Medium); player.SceneAs <Level>().DirectionalShake((Vector2)data["starFlyLastDir"], 0.3f); while ((float)data["starFlyTimer"] > 0.5f) { yield return(null); } ((SoundSource)data["starFlyWarningSfx"]).Play("event:/game/06_reflection/feather_state_warning", null, 0f); yield break; }
public static void CustomFeatherEnd() { Player player = FrostModule.StateGetPlayer(); DynData <Player> data = new DynData <Player>(player); CustomFeather feather = (CustomFeather)data["fh.customFeather"]; player.Play("event:/game/06_reflection/feather_state_end", null, 0f); ((SoundSource)data["starFlyWarningSfx"]).Stop(true); ((SoundSource)data["starFlyLoopSfx"]).Stop(true); player.Hair.DrawPlayerSpriteOutline = false; player.Sprite.Color = Color.White; player.SceneAs <Level>().Displacement.AddBurst(player.Center, 0.25f, 8f, 32f, 1f, null, null); ((BloomPoint)data["starFlyBloom"]).Visible = false; player.Sprite.HairCount = (int)data["startHairCount"]; player_StarFlyReturnToNormalHitbox.Invoke(player, null); bool flag = player.StateMachine.State != 2; if (flag) { player.SceneAs <Level>().Particles.Emit(feather.P_Boost, 12, player.Center, Vector2.One * 4f, (-player.Speed).Angle()); } }
public static void CustomFeatherBegin() { Player player = FrostModule.StateGetPlayer(); DynData <Player> data = new DynData <Player>(player); CustomFeather feather = (CustomFeather)data["fh.customFeather"]; player.Sprite.Play("startStarFly", false, false); data["starFlyTransforming"] = true; data["starFlyTimer"] = feather.FlyTime; data["starFlySpeedLerp"] = 0f; data["jumpGraceTimer"] = 0f; BloomPoint starFlyBloom = (BloomPoint)data["starFlyBloom"]; if (starFlyBloom == null) { player.Add(starFlyBloom = new BloomPoint(new Vector2(0f, -6f), 0f, 16f)); } starFlyBloom.Visible = true; starFlyBloom.Alpha = 0f; data["starFlyBloom"] = starFlyBloom; player.Collider = (Hitbox)data["starFlyHitbox"]; data["hurtbox"] = data["starFlyHurtbox"]; SoundSource starFlyLoopSfx = (SoundSource)data["starFlyLoopSfx"]; SoundSource starFlyWarningSfx = (SoundSource)data["starFlyWarningSfx"]; if (starFlyLoopSfx == null) { player.Add(starFlyLoopSfx = new SoundSource()); starFlyLoopSfx.DisposeOnTransition = false; player.Add(starFlyWarningSfx = new SoundSource()); starFlyWarningSfx.DisposeOnTransition = false; } starFlyLoopSfx.Play("event:/game/06_reflection/feather_state_loop", "feather_speed", 1f); starFlyWarningSfx.Stop(true); data["starFlyLoopSfx"] = starFlyLoopSfx; data["starFlyWarningSfx"] = starFlyWarningSfx; }
public static int StarFlyUpdate() { Player player = FrostModule.StateGetPlayer(); Level level = player.SceneAs <Level>(); DynData <Player> data = new DynData <Player>(player); BloomPoint bloomPoint = (BloomPoint)data["starFlyBloom"]; CustomFeather feather = (CustomFeather)data["fh.customFeather"]; // 2f -> StarFlyTime float StarFlyTime = feather.FlyTime; bloomPoint.Alpha = Calc.Approach(bloomPoint.Alpha, 0.7f, Engine.DeltaTime * StarFlyTime); data["starFlyBloom"] = bloomPoint; Input.Rumble(RumbleStrength.Climb, RumbleLength.Short); if ((bool)data["starFlyTransforming"]) { player.Speed = Calc.Approach(player.Speed, Vector2.Zero, 1000f * Engine.DeltaTime); } else { Vector2 aimValue = Input.Aim.Value; bool notAiming = false; bool flag3 = aimValue == Vector2.Zero; if (flag3) { notAiming = true; aimValue = (Vector2)data["starFlyLastDir"]; } Vector2 lastSpeed = player.Speed.SafeNormalize(Vector2.Zero); bool flag4 = lastSpeed == Vector2.Zero; if (flag4) { lastSpeed = aimValue; } else { lastSpeed = lastSpeed.RotateTowards(aimValue.Angle(), 5.58505344f * Engine.DeltaTime); } data["starFlyLastDir"] = lastSpeed; float target; if (notAiming) { data["starFlySpeedLerp"] = 0f; target = feather.NeutralSpeed; // was 91f } else { bool flag6 = lastSpeed != Vector2.Zero && Vector2.Dot(lastSpeed, aimValue) >= 0.45f; if (flag6) { data["starFlySpeedLerp"] = Calc.Approach((float)data["starFlySpeedLerp"], 1f, Engine.DeltaTime / 1f); target = MathHelper.Lerp(feather.LowSpeed, feather.MaxSpeed, (float)data["starFlySpeedLerp"]); } else { data["starFlySpeedLerp"] = 0f; target = 140f; } } SoundSource ss = (SoundSource)data["starFlyLoopSfx"]; ss.Param("feather_speed", notAiming ? 0 : 1); data["starFlyLoopSfx"] = ss; float num = player.Speed.Length(); num = Calc.Approach(num, target, 1000f * Engine.DeltaTime); player.Speed = lastSpeed * num; bool flag7 = level.OnInterval(0.02f); if (flag7) { level.Particles.Emit(feather.P_Flying, 1, player.Center, Vector2.One * 2f, feather.FlyColor, (-player.Speed).Angle()); } bool pressed = Input.Jump.Pressed; if (pressed) { bool flag8 = player.OnGround(3); if (flag8) { player.Jump(true, true); return(0); } bool flag9 = (bool)player_WallJumpCheck.Invoke(player, new object[] { -1 }); if (flag9) { player_WallJump.Invoke(player, new object[] { 1 }); return(0); } bool flag10 = (bool)player_WallJumpCheck.Invoke(player, new object[] { 1 }); if (flag10) { player_WallJump.Invoke(player, new object[] { -1 }); return(0); } } bool check = Input.Grab.Check; if (check) { bool flag11 = false; int dir = 0; bool flag12 = Input.MoveX.Value != -1 && player.ClimbCheck(1, 0); if (flag12) { player.Facing = Facings.Right; dir = 1; flag11 = true; } else { bool flag13 = Input.MoveX.Value != 1 && player.ClimbCheck(-1, 0); if (flag13) { player.Facing = Facings.Left; dir = -1; flag11 = true; } } bool flag14 = flag11; if (flag14) { bool noGrabbing = Celeste.SaveData.Instance.Assists.NoGrabbing; if (noGrabbing) { player.Speed = Vector2.Zero; player.ClimbTrigger(dir); return(0); } return(1); } } bool canDash = player.CanDash; if (canDash) { return(player.StartDash()); } float starFlyTimer = (float)data["starFlyTimer"]; starFlyTimer -= Engine.DeltaTime; data["starFlyTimer"] = starFlyTimer; bool flag15 = starFlyTimer <= 0f; if (flag15) { bool flag16 = Input.MoveY.Value == -1; if (flag16) { player.Speed.Y = -100f; } bool flag17 = Input.MoveY.Value < 1; if (flag17) { data["varJumpSpeed"] = player.Speed.Y; player.AutoJump = true; player.AutoJumpTimer = 0f; data["varJumpTimer"] = 0.2f; } bool flag18 = player.Speed.Y > 0f; if (flag18) { player.Speed.Y = 0f; } bool flag19 = Math.Abs(player.Speed.X) > 140f; if (flag19) { player.Speed.X = 140f * Math.Sign(player.Speed.X); } Input.Rumble(RumbleStrength.Medium, RumbleLength.Medium); return(0); } bool flag20 = starFlyTimer < 0.5f && player.Scene.OnInterval(0.05f); if (flag20) { Color starFlyColor = feather.FlyColor; if (player.Sprite.Color == starFlyColor) { player.Sprite.Color = Player.NormalHairColor; } else { player.Sprite.Color = starFlyColor; } } } return(CustomFeatherState); }