示例#1
0
 private IEnumerator onRedDashCoroutine(On.Celeste.Player.orig_RedDashCoroutine orig, Player self)
 {
     if (Settings.DashDirection == 0)
     {
         return(orig(self));
     }
     return(modDashCoroutine(orig(self), self));
 }
        private static IEnumerator Player_RedDashCoroutine(On.Celeste.Player.orig_RedDashCoroutine orig, Player self)
        {
            // get the booster now, it'll be set to null in the coroutine
            Booster currentBooster = self.CurrentBooster;

            // do the entire coroutine, thanks max480 :)
            IEnumerator origEnum = orig(self);

            while (origEnum.MoveNext())
            {
                yield return(origEnum.Current);
            }

            if (currentBooster is DreamBooster booster)
            {
                DynData <Player> playerData = new DynData <Player>(self);
                self.Speed = ((Vector2)(playerData["gliderBoostDir"] = self.DashDir = booster.Dir)) * 240f;
                self.SceneAs <Level>().DirectionalShake(self.DashDir, 0.2f);
                if (self.DashDir.X != 0f)
                {
                    self.Facing = (Facings)Math.Sign(self.DashDir.X);
                }
            }
        }