public void DreamDashStartBefore(Player player)
        {
            Vector2 stickSpeed = wallPlayerSpeed.GetOrDefault(player, new ValueHolder <Vector2>(player.Speed)).value;

            wallPlayerRenderOffset.Remove(player);
            wallPlayerRotations.Remove(player);
            wallPlayerSpeed.Remove(player);

            if (UseEntrySpeedAngle)
            {
                Vector2 entryVector = stickSpeed.SafeNormalize();
                float   magnitude   = stickSpeed.Length();

                player.Speed = entryVector * magnitude;
            }
        }
Beispiel #2
0
 private static ModelHandlers GetModelHandlers(EventCommand command, IModel model, bool create)
 {
     lock (_commandsHandlers) {
         if (create)
         {
             ConditionalWeakTable <IModel, ModelHandlers> modelsHandlers = _commandsHandlers.GetOrAdd(command, () => {
                 command.Subscribe(OnCommandExecute, OnCommandCanExecute);
                 return(new ConditionalWeakTable <IModel, ModelHandlers>());
             });
             return(modelsHandlers.GetValue(model, k => new ModelHandlers()));
         }
         else
         {
             ConditionalWeakTable <IModel, ModelHandlers> modelsHandlers = _commandsHandlers.GetOrDefault(command);
             return(modelsHandlers == null ? null : modelsHandlers.GetOrDefault(model));
         }
     }
 }
        private static void Player_Render(On.Celeste.Player.orig_Render orig, Player self)
        {
            Level level = self.Scene as Level;

            float   playerRotation = wallPlayerRotations.GetOrDefault(self, new ValueHolder <float>(0f)).value;
            Vector2 renderOffset   = wallPlayerRenderOffset.GetOrDefault(self, new ValueHolder <Vector2>(new Vector2(0f, 0f))).value;

            if (level != null && playerRotation != 0f)
            {
                Camera camera = level.Camera;

                float   originalAngle              = camera.Angle;
                Vector2 originalCameraPosition     = camera.Position;
                Vector2 originalCameraOrigin       = camera.Origin;
                Vector2 originalPlayerPosition     = self.Sprite.Position;
                Vector2 originalPlayerHairPosition = self.Hair.Sprite.Position;

                GameplayRenderer.End();
                camera.Angle          = playerRotation;
                camera.Origin         = self.Position + renderOffset - camera.Position;
                camera.Position      += camera.Origin;
                self.Sprite.Position += renderOffset;
                self.Hair.MoveHairBy(renderOffset);
                GameplayRenderer.Begin();

                orig(self);

                GameplayRenderer.End();
                camera.Angle         = originalAngle;
                camera.Origin        = originalCameraOrigin;
                camera.Position      = originalCameraPosition;
                self.Sprite.Position = originalPlayerPosition;
                self.Hair.MoveHairBy(-renderOffset);
                GameplayRenderer.Begin();
            }
            else
            {
                orig(self);
            }
        }