private IEnumerator BirdRoutine(float delay) { yield return(delay); Level.Add(bird = new BirdNPC(Vector2.Zero, BirdNPC.Modes.None)); bird.Sprite.Play("flyupIdle"); Vector2 center = new Vector2(320f, 180f) / 2f; Vector2 topCenter = new Vector2(center.X, 0.0f); Vector2 botCenter = new Vector2(center.X, 180f); Vector2 from1 = botCenter + new Vector2(40f, 40f); Vector2 to1 = center + new Vector2(-32f, -24f); for (var t = 0.0f; t < 1.0; t += Engine.DeltaTime / 4f) { birdScreenPosition = from1 + (to1 - from1) * Ease.BackOut(t); yield return(null); } bird.Sprite.Play("flyupRoll"); for (var t = 0.0f; t < 1.0; t += Engine.DeltaTime / 2f) { birdScreenPosition = to1 + new Vector2(64f, 0.0f) * Ease.CubeInOut(t); yield return(null); } Vector2 from2 = birdScreenPosition; Vector2 to2 = topCenter + new Vector2(-40f, -100f); var playedAnim = false; for (var t = 0.0f; t < 1.0; t += Engine.DeltaTime / 4f) { if (t >= 0.349999994039536 && !playedAnim) { bird.Sprite.Play("flyupRoll"); playedAnim = true; } birdScreenPosition = from2 + (to2 - from2) * Ease.BigBackIn(t); birdScreenPosition.X += t * 32f; yield return(null); } bird.RemoveSelf(); bird = null; }
/// <summary> /// Creates a new bird object for use in the renderer /// </summary> private void NewBirdy(Player ply, Level currentLevel, InfoPanel infoPanel) { if (birdy == null && currentLevel != null) { birdy = new BirdNPC(ply.Position, BirdNPC.Modes.None); birdy.Sprite.Color = birdColor; birdy.Sprite.Effects = Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally; if (!settings.MirrorEnabled) { birdy.Sprite.Effects = Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally; birdy.Position = currentLevel.Camera.Position + new Vector2(infoPanel.uiPos.X, infoPanel.uiPos.Y - 182f); } else { birdy.Position = new Vector2(30, 30); } } }
public FlingBirdReversed(Vector2[] nodes, bool skippAble) : base(nodes, skippAble) { Get<Sprite>()?.RemoveSelf(); Get<PlayerCollider>()?.RemoveSelf(); Get<SoundSource>()?.RemoveSelf(); Get<TransitionListener>()?.RemoveSelf(); Add(sprite = GFX.SpriteBank.Create("bird")); sprite.Play("hover"); // sprite.Scale.X = -1f; sprite.Scale.X = 1f; sprite.Position = spriteOffset; sprite.OnFrameChange = delegate { BirdNPC.FlapSfxCheck(sprite); }; Collider = new Circle(16f); Add(new PlayerCollider(OnPlayer)); Add(moveSfx = new SoundSource()); NodeSegments = new List<Vector2[]>(); NodeSegments.Add(nodes); SegmentsWaiting = new List<bool>(); SegmentsWaiting.Add(skippAble); Add(new TransitionListener { OnOut = delegate(float t) { sprite.Color = Color.White * (1f - Calc.Map(t, 0f, 0.4f)); } }); }
private static IEnumerator killFlyAwayEffects(On.Celeste.BirdNPC.orig_StartleAndFlyAway orig, BirdNPC self) { if (self is CustomTutorialWithNoBird) { // don't play any flying away effect since there is no bird! yield break; } // just let the original routine go. yield return(new SwapImmediately(orig(self))); }