Exemplo n.º 1
0
 private static Color getRainbowDecalComponentHue(Func <Component, Vector2, Color> orig, Component self, Vector2 position)
 {
     foreach (RainbowSpinnerColorAreaController controller in self.Scene.Tracker.GetEntities <RainbowSpinnerColorAreaController>())
     {
         if (controller.Collider.Collide(position))
         {
             return(RainbowSpinnerColorController.getModHue(controller.colors, controller.gradientSize, self.Scene, position, controller.loopColors, controller.center, controller.gradientSpeed));
         }
     }
     return(orig(self, position));
 }
Exemplo n.º 2
0
        public override void Update()
        {
            base.Update();

            if (transitionProgress == -1f && spinnerControllerOnScreen == null)
            {
                // no transition is ongoing.
                // if only nextSpinnerController is defined, move it into spinnerControllerOnScreen.
                spinnerControllerOnScreen = nextSpinnerController;
                nextSpinnerController     = null;
            }
        }
Exemplo n.º 3
0
        private static Color getEntityHue(Func <Color> origMethod, Entity self, Vector2 position)
        {
            if (transitionProgress == -1f)
            {
                if (spinnerControllerOnScreen == null)
                {
                    // no transition is ongoing.
                    // if only nextSpinnerController is defined, move it into spinnerControllerOnScreen.
                    spinnerControllerOnScreen = nextSpinnerController;
                    nextSpinnerController     = null;
                }

                if (spinnerControllerOnScreen != null)
                {
                    return(getModHue(spinnerControllerOnScreen.colors, spinnerControllerOnScreen.gradientSize, self.Scene, position,
                                     spinnerControllerOnScreen.loopColors, spinnerControllerOnScreen.center, spinnerControllerOnScreen.gradientSpeed));
                }
                else
                {
                    return(origMethod());
                }
            }
            else
            {
                // get the spinner color in the room we're coming from.
                Color fromRoomColor;
                if (spinnerControllerOnScreen != null)
                {
                    fromRoomColor = getModHue(spinnerControllerOnScreen.colors, spinnerControllerOnScreen.gradientSize, self.Scene, position,
                                              spinnerControllerOnScreen.loopColors, spinnerControllerOnScreen.center, spinnerControllerOnScreen.gradientSpeed);
                }
                else
                {
                    fromRoomColor = origMethod();
                }

                // get the spinner color in the room we're going to.
                Color toRoomColor;
                if (nextSpinnerController != null)
                {
                    toRoomColor = getModHue(nextSpinnerController.colors, nextSpinnerController.gradientSize, self.Scene, position,
                                            nextSpinnerController.loopColors, nextSpinnerController.center, nextSpinnerController.gradientSpeed);
                }
                else
                {
                    toRoomColor = origMethod();
                }

                // transition smoothly between both.
                return(Color.Lerp(fromRoomColor, toRoomColor, transitionProgress));
            }
        }
Exemplo n.º 4
0
        private static Color getRainbowSpinnerHue(On.Celeste.CrystalStaticSpinner.orig_GetHue orig, CrystalStaticSpinner self, Vector2 position)
        {
            RainbowSpinnerColorAreaController controller = self.CollideFirst <RainbowSpinnerColorAreaController>(position);

            if (controller != null)
            {
                // apply the color from the controller we are in.
                return(RainbowSpinnerColorController.getModHue(controller.colors, controller.gradientSize, self.Scene, position, controller.loopColors, controller.center, controller.gradientSpeed));
            }
            else
            {
                // we are not in a controller; apply the vanilla color.
                return(orig(self, position));
            }
        }
Exemplo n.º 5
0
        public override void Awake(Scene scene)
        {
            base.Awake(scene);

            // this is the controller for the next screen.
            nextSpinnerController = this;

            // enable the hook on rainbow spinner hue.
            if (!rainbowSpinnerHueHooked)
            {
                On.Celeste.CrystalStaticSpinner.GetHue += getRainbowSpinnerHue;
                hookJungleHelper();
                rainbowSpinnerHueHooked = true;
            }
        }
Exemplo n.º 6
0
        public override void SceneEnd(Scene scene)
        {
            base.SceneEnd(scene);

            // leaving level: forget about all controllers and clean up the hook if present.
            spinnerControllerOnScreen = null;
            nextSpinnerController     = null;
            if (rainbowSpinnerHueHooked)
            {
                On.Celeste.CrystalStaticSpinner.GetHue -= getRainbowSpinnerHue;
                jungleHelperHook?.Dispose();
                jungleHelperHook        = null;
                rainbowSpinnerHueHooked = false;
            }
            ;
        }
Exemplo n.º 7
0
        public override void Removed(Scene scene)
        {
            base.Removed(scene);

            // the "current" spinner controller is now the one from the next screen.
            spinnerControllerOnScreen = nextSpinnerController;
            nextSpinnerController     = null;

            // the transition (if any) is over.
            transitionProgress = -1f;

            // if there is none, clean up the hook on the spinner hue.
            if (spinnerControllerOnScreen == null && rainbowSpinnerHueHooked)
            {
                On.Celeste.CrystalStaticSpinner.GetHue -= getRainbowSpinnerHue;
                jungleHelperHook?.Dispose();
                jungleHelperHook        = null;
                rainbowSpinnerHueHooked = false;
            }
        }