Example #1
0
        public CustomFireBarrier(EntityData data, Vector2 offset) : base(data.Position + offset)
        {
            float width  = data.Width;
            float height = data.Height;

            isIce    = data.Bool("isIce", false);
            Tag      = Tags.TransitionUpdate;
            Collider = new Hitbox(width, height, 0f, 0f);
            Add(new PlayerCollider(new Action <Player>(OnPlayer), null, null));
            Add(new CoreModeListener(new Action <Session.CoreModes>(OnChangeMode)));
            Lava = new LavaRect(width, height, isIce ? 2 : 4);
            Add(Lava);
            Lava.SurfaceColor       = data.HexColor("surfaceColor");
            Lava.EdgeColor          = data.HexColor("edgeColor");
            Lava.CenterColor        = data.HexColor("centerColor");
            Lava.SmallWaveAmplitude = 2f;
            Lava.BigWaveAmplitude   = 1f;
            Lava.CurveAmplitude     = 1f;
            if (isIce)
            {
                Lava.UpdateMultiplier   = 0f;
                Lava.Spikey             = 3f;
                Lava.SmallWaveAmplitude = 1f;
            }

            lavaRect = new Rectangle((int)(data.Position + offset).X, (int)(data.Position + offset).Y, (int)width, (int)height);
            Depth    = -8500;
            if (!isIce && !data.Bool("silent", false))
            {
                Add(idleSfx      = new SoundSource());
                idleSfx.Position = new Vector2(Width, Height) / 2f;
            }
        }
 private float LavaRect_Wave(On.Celeste.LavaRect.orig_Wave orig, LavaRect self, int step, float length)
 {
     if (Settings.SimplifiedGraphics)
     {
         return(0f);
     }
     return(orig(self, step, length));
 }
        public override void Awake(Scene scene)
        {
            base.Awake(scene);

            // waiting is broken, lava won't center at the right position.
            Waiting = false;

            // prevent the "ease in" effect that is more confusing than anything in our case.
            LavaRect topRectVal    = (LavaRect)topRect.GetValue(this);
            LavaRect bottomRectVal = (LavaRect)bottomRect.GetValue(this);

            topRectVal.Position.Y    = -360f;
            bottomRectVal.Position.Y = 0f;
        }
Example #4
0
 public CustomRisingLava(bool intro, float speed, Color[] coldColors, Color[] hotColors, bool reverseCoreMode)
 {
     delay      = 0f;
     this.intro = intro;
     Speed      = speed;
     Depth      = -1000000;
     Collider   = new Hitbox(340f, 120f, 0f, 0f);
     Visible    = false;
     Add(new PlayerCollider(new Action <Player>(OnPlayer), null, null));
     Add(new CoreModeListener(new Action <Session.CoreModes>(OnChangeMode)));
     Add(loopSfx                   = new SoundSource());
     Add(bottomRect                = new LavaRect(400f, 200f, 4));
     bottomRect.Position           = new Vector2(-40f, 0f);
     bottomRect.OnlyMode           = LavaRect.OnlyModes.OnlyTop;
     bottomRect.SmallWaveAmplitude = 2f;
     Cold            = coldColors;
     Hot             = hotColors;
     ReverseCoreMode = reverseCoreMode;
 }
Example #5
0
        public CustomSandwichLava(EntityData data, Vector2 offset)
        {
            startX    = data.Position.X + offset.X;
            Direction = data.Enum("direction", DirectionMode.CoreModeBased);
            Speed     = data.Float("speed", 20f);

            // vanilla is 160. so, setting sandwichGap to 120 requires each side to be shifted by 20 pixels towards the other ((160 - 120) / 2).
            sandwichDisplacement = (160f - data.Float("sandwichGap", 160f)) / 2;

            Depth    = -1000000;
            Collider = new ColliderList(new Hitbox(340f, 120f, 0f, -sandwichDisplacement), new Hitbox(340f, 120f, 0f, -280f + sandwichDisplacement));
            Visible  = false;

            Add(loopSfx = new SoundSource());
            Add(new PlayerCollider(OnPlayer));
            Add(new CoreModeListener(OnChangeMode));

            Add(bottomRect                = new LavaRect(400f, 200f, 4));
            bottomRect.Position           = new Vector2(-40f, 0f);
            bottomRect.OnlyMode           = LavaRect.OnlyModes.OnlyTop;
            bottomRect.SmallWaveAmplitude = 2f;

            Add(topRect                = new LavaRect(400f, 200f, 4));
            topRect.Position           = new Vector2(-40f, -360f);
            topRect.OnlyMode           = LavaRect.OnlyModes.OnlyBottom;
            topRect.SmallWaveAmplitude = 2f;
            topRect.BigWaveAmplitude   = (bottomRect.BigWaveAmplitude = 2f);
            topRect.CurveAmplitude     = (bottomRect.CurveAmplitude = 4f);

            Add(new TransitionListener {
                OnOutBegin = () => {
                    // save the Y positions
                    transitionStartY           = Y;
                    transitionStartTopRectY    = topRect.Position.Y;
                    transitionStartBottomRectY = bottomRect.Position.Y;

                    if (persistent && Scene != null && Scene.Entities.FindAll <CustomSandwichLava>().Count <= 1)
                    {
                        // no lava in the next room: leave
                        Leave();
                    }
                    else
                    {
                        // look up for all lava blocker triggers in the next room.
                        lavaBlockerTriggers = Scene.Entities.OfType <LavaBlockerTrigger>().ToList();
                    }
                },
                OnOut = progress => {
                    if (Scene != null)
                    {
                        X = (Scene as Level).Camera.X;
                        if (!leaving)
                        {
                            // make the lava elements transition smoothly to their expected positions.
                            Y = MathHelper.Lerp(transitionStartY, centerY, progress);
                            topRect.Position.Y    = MathHelper.Lerp(transitionStartTopRectY, TopOffset - topRect.Height + sandwichDisplacement, progress);
                            bottomRect.Position.Y = MathHelper.Lerp(transitionStartBottomRectY, -sandwichDisplacement, progress);
                        }
                    }

                    if ((progress > 0.95f) && leaving)
                    {
                        // lava is leaving, transition is over soon => remove it
                        RemoveSelf();
                    }
                },
                OnInEnd = () => {
                    if (entering)
                    {
                        // transition is over. grab the camera position now since it's done moving.
                        Y        = centerY;
                        entering = false;
                    }
                }
            });
        }