Пример #1
0
        private static int Player_DreamDashUpdate(On.Celeste.Player.orig_DreamDashUpdate orig, Player self)
        {
            DreamDashController controller = self.Scene.Tracker.GetEntity <DreamDashController>();

            controller?.AttemptBounce(self);

            return(orig(self));
        }
Пример #2
0
        private static int Player_DreamDashUpdate(On.Celeste.Player.orig_DreamDashUpdate orig, Player self)
        {
            DreamDashController controller = self.Scene.Tracker.GetEntity <DreamDashController>();

            bool bounced = controller?.AttemptBounce(self) ?? false;

            if (bounced)
            {
                return(self.StateMachine.State);
            }
            else
            {
                return(orig(self));
            }
        }
Пример #3
0
        private static int Player_DreamDashUpdate(On.Celeste.Player.orig_DreamDashUpdate orig, Player self)
        {
            CustomDreamBlockV2 currentDreamBlock = self.CollideFirst <CustomDreamBlockV2>();

            if (currentDreamBlock != null)
            {
                var dyn = new DynData <Player>(self);

                if (!currentDreamBlock.ConserveSpeed)
                {
                    float lastDreamSpeed = dyn.Get <float>("lastDreamSpeed");
                    if (lastDreamSpeed != currentDreamBlock.DashSpeed)
                    {
                        self.Speed = self.DashDir * currentDreamBlock.DashSpeed;
                        dyn.Set("lastDreamSpeed", currentDreamBlock.DashSpeed * 1f);
                    }
                }

                // Redirects
                if (currentDreamBlock.AllowRedirects && self.CanDash)
                {
                    Vector2 aimVector = Input.GetAimVector(Facings.Right);
                    bool    sameDir   = aimVector == self.DashDir;
                    if (!sameDir || currentDreamBlock.AllowRedirectsInSameDir)
                    {
                        self.DashDir = aimVector;
                        self.Speed   = self.DashDir * self.Speed.Length();
                        self.Dashes  = Math.Max(0, self.Dashes - 1);
                        Audio.Play("event:/char/madeline/dreamblock_enter");
                        if (sameDir)
                        {
                            self.Speed   *= currentDreamBlock.SameDirectionSpeedMultiplier;
                            self.DashDir *= Math.Sign(currentDreamBlock.SameDirectionSpeedMultiplier);
                        }
                        Input.Dash.ConsumeBuffer();
                        Input.Dash.ConsumePress();
                        Input.CrouchDash.ConsumeBuffer();
                        Input.CrouchDash.ConsumePress();
                    }
                }
            }
            return(orig(self));
        }