private void MoveToTarget()
        {
            float   sine   = (float)Math.Sin(sineWave) * 4f;
            Vector2 vector = Calc.YoYo(Ease.QuadIn(dashEase)) * dashDirection * 8f;

            for (int i = 0; i < 2; i++)
            {
                foreach (KeyValuePair <Platform, Vector2> keyValuePair in Moves)
                {
                    Platform key      = keyValuePair.Key;
                    bool     hasRider = false;
                    JumpThru jumpThru = key as JumpThru;
                    Solid    solid    = key as Solid;
                    if ((jumpThru != null && jumpThru.HasRider()) || (solid != null && solid.HasRider()))
                    {
                        hasRider = true;
                    }

                    if ((hasRider || i != 0) && (!hasRider || i != 1))
                    {
                        Vector2 value = keyValuePair.Value;
                        float   num2  = MathHelper.Lerp(value.Y, value.Y + 12f, Ease.SineInOut(yLerp)) + sine;
                        key.MoveToY(num2 + vector.Y);
                        key.MoveToX(value.X + vector.X);
                    }
                }
            }
        }
        private void moveToTarget()
        {
            float   sine         = (float)Math.Sin(sineWave) * 4f;
            Vector2 displacement = Calc.YoYo(Ease.QuadIn(dashEase)) * dashDirection * 8f;

            for (int i = 0; i < 2; i++)
            {
                foreach (KeyValuePair <Platform, Vector2> move in moves)
                {
                    Platform platform  = move.Key;
                    bool     hasPlayer = false;
                    JumpThru jumpThru  = platform as JumpThru;
                    Solid    solid     = platform as Solid;
                    if ((jumpThru != null && jumpThru.HasRider()) || (solid?.HasRider() ?? false))
                    {
                        hasPlayer = true;
                    }
                    if ((hasPlayer || i != 0) && (!hasPlayer || i != 1))
                    {
                        Vector2 value = move.Value;
                        float   yMove = MathHelper.Lerp(value.Y, value.Y + 12f, Ease.SineInOut(yLerp)) + sine;
                        platform.MoveToY(yMove + displacement.Y);
                        platform.MoveToX(value.X + displacement.X);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private bool IsRiding(JumpThru jumpThru)
 {
     if (direction != 0)
     {
         return(false);
     }
     return(base.CollideCheck(jumpThru, base.Position + Vector2.UnitY));
 }
 protected virtual bool IsRiding(JumpThru jumpThru)
 {
     if (Direction != 0)
     {
         return(false);
     }
     return(CollideCheck(jumpThru, Position + Vector2.UnitY));
 }
Ejemplo n.º 5
0
 private void AddJumpThru(JumpThru jp)
 {
     Jumpthrus.Add(jp);
     foreach (GroupedFallingBlock entity in Scene.Tracker.GetEntities <GroupedFallingBlock>())
     {
         if (!entity.HasGroup && entity._tileType == _tileType && Scene.CollideCheck(new Rectangle((int)jp.X - 1, (int)jp.Y, (int)jp.Width + 2, (int)jp.Height), entity))
         {
             AddToGroupAndFindChildren(entity);
         }
     }
 }
 private void addJumpThru(JumpThru jp)
 {
     jp.OnDashCollide = onDash;
     jumpthrus.Add(jp);
     moves.Add(jp, jp.Position);
     foreach (FloatySpaceBlockWithAttachedSidewaysJumpthruSupport block in Scene.Tracker.GetEntities <FloatySpaceBlockWithAttachedSidewaysJumpthruSupport>())
     {
         if (!block.HasGroup && block.tileType == tileType && Scene.CollideCheck(new Rectangle((int)jp.X - 1, (int)jp.Y, (int)jp.Width + 2, (int)jp.Height), block))
         {
             addToGroupAndFindChildren(block);
         }
     }
 }
 private bool IsRiding(JumpThru jumpThru)
 {
     return(direction == Directions.Up && CollideCheck(jumpThru, Position + Vector2.UnitY));
 }
        public static int RedDashUpdate()
        {
            Player           player = FrostModule.StateGetPlayer();
            DynData <Player> data   = new DynData <Player>(player);

            data["StartedDashing"] = false;
            bool ch9hub = false;//this.LastBooster != null && this.LastBooster.Ch9HubTransition;

            data["gliderBoostTimer"] = 0.05f;
            if (player.CanDash)
            {
                GenericCustomBooster booster = null;
                foreach (GenericCustomBooster b in player.Scene.Tracker.GetEntities <GenericCustomBooster>())
                {
                    if (b.BoostingPlayer)
                    {
                        booster = b;
                        break;
                    }
                }
                booster.BoostingPlayer = false;
                return(player.StartDash());
            }
            if (player.DashDir.Y == 0f)
            {
                foreach (Entity entity in player.Scene.Tracker.GetEntities <JumpThru>())
                {
                    JumpThru jumpThru = (JumpThru)entity;
                    if (player.CollideCheck(jumpThru) && player.Bottom - jumpThru.Top <= 6f)
                    {
                        player.MoveVExact((int)(jumpThru.Top - player.Bottom), null, null);
                    }
                }
                if (player.CanUnDuck && Input.Jump.Pressed && data.Get <float>("jumpGraceTimer") > 0f && !ch9hub)
                {
                    //player.SuperJump();
                    Player_SuperJump.Invoke(player, null);
                    return(0);
                }
            }
            if (!ch9hub)
            {
                if (data.Get <bool>("SuperWallJumpAngleCheck"))
                {
                    if (Input.Jump.Pressed && player.CanUnDuck)
                    {
                        if ((bool)player_WallJumpCheck.Invoke(player, new object[] { 1 }))
                        {
                            Player_SuperWallJump.Invoke(player, new object[] { -1 });
                            return(0);
                        }
                        if ((bool)player_WallJumpCheck.Invoke(player, new object[] { -1 }))
                        {
                            Player_SuperWallJump.Invoke(player, new object[] { 1 });
                            return(0);
                        }
                    }
                }
                else if (Input.Jump.Pressed && player.CanUnDuck)
                {
                    if ((bool)player_WallJumpCheck.Invoke(player, new object[] { 1 }))
                    {
                        if (player.Facing == Facings.Right && Input.Grab.Check && player.Stamina > 0f && player.Holding == null && !ClimbBlocker.Check(player.Scene, player, player.Position + Vector2.UnitX * 3f))
                        {
                            Player_ClimbJump.Invoke(player, null);
                        }
                        else
                        {
                            player_WallJump.Invoke(player, new object[] { -1 });
                        }
                        return(0);
                    }
                    if ((bool)player_WallJumpCheck.Invoke(player, new object[] { -1 }))
                    {
                        if (player.Facing == Facings.Left && Input.Grab.Check && player.Stamina > 0f && player.Holding == null && !ClimbBlocker.Check(player.Scene, player, player.Position + Vector2.UnitX * -3f))
                        {
                            Player_ClimbJump.Invoke(player, null);
                        }
                        else
                        {
                            player_WallJump.Invoke(player, new object[] { 1 });
                        }
                        return(0);
                    }
                }
            }
            return(CustomRedBoostState);//5;
        }
Ejemplo n.º 9
0
 public override bool IsRiding(JumpThru jumpThru)
 {
     return(false);
 }
Ejemplo n.º 10
0
        private void OverlayEntities(MapElement entities, Bitmap map, VirtualMap <char> solids, bool background)
        {
            CassetteBlock.Blocks.Clear();

            using (Graphics g = Graphics.FromImage(map)) {
                List <Entity> ents = new List <Entity>();
                for (int i = entities.Children.Count - 1; i >= 0; i--)
                {
                    MapElement child = entities.Children[i];

                    Entity entity = null;
                    if (child.Name.IndexOf("spikes", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        entity = background ? Spikes.FromElement(child) : null;
                    }
                    else if (child.Name.IndexOf("triggerSpikes", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        entity = background ? TriggerSpikes.FromElement(child) : null;
                    }
                    else if (child.Name.IndexOf("strawberry", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        entity = background ? Strawberry.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("goldenBerry", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Strawberry.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("redBlocks", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? ClutterBlock.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("greenBlocks", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? ClutterBlock.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("yellowBlocks", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? ClutterBlock.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("clutterCabinet", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? ClutterCabinet.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("introCar", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? IntroCar.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("clothesLine", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? ClothesLine.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("colorSwitch", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? ColorSwitch.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("memorialTextController", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Strawberry.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("bonfire", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Bonfire.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("trapDoor", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? TrapDoor.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("movingPlatform", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? MovingPlatform.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("sinkingPlatform", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? SinkingPlatform.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("clutterDoor", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? ClutterDoor.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("bridge", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Bridge.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("bridgeFixed", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? BridgeFixed.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("jumpThru", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? JumpThru.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("door", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Door.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("blockField", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? BlockField.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("lamp", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Lamp.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("hahaha", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Haha.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("waterFall", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? WaterFall.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("water", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Water.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("key", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Key.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("resortLantern", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? ResortLantern.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("bird", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Bird.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("memorial", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Memorial.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("player", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? PlayerSpawn.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("zipMover", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? ZipMover.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("wire", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Wire.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("crumbleBlock", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? CrumbleBlock.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("refill", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Refill.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("spring", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Spring.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("fakeWall", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? FakeWall.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("exitBlock", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? FakeWall.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("lightBeam", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? LightBeam.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("cobweb", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Cobweb.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("cassette", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Cassette.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("flutterBird", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? FlutterBird.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("checkpoint", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Checkpoint.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("fallingBlock", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? FallingBlock.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("introCrusher", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? FallingBlock.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("cassetteBlock", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? CassetteBlock.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("dashBlock", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? DashBlock.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("coverupWall", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? CoverupWall.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("npc", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? NPC.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("birdForsakenCityGem", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? ForsakenCityGem.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("soundSource", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? SoundSource.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("friendlyGhost", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? FriendlyGhost.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("floatingDebris", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? FloatingDebris.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("hangingLamp", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? HangingLamp.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("lockBlock", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? LockBlock.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("heartGem", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? HeartGem.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("blackGem", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? HeartGem.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("dreamMirror", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? DreamMirror.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("darkChaser", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? DarkChaser.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("dreamBlock", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? DreamBlock.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("touchSwitch", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? TouchSwitch.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("switchGate", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? SwitchGate.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("invisibleBarrier", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? InvisibleBarrier.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("payphone", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Payphone.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("spinner", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? Spinner.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("rotateSpinner", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? RotateSpinner.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("trackSpinner", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? TrackSpinner.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("towerViewer", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = background ? TowerViewer.FromElement(child) : null;
                    }
                    else if (child.Name.Equals("foregroundDebris", StringComparison.OrdinalIgnoreCase))
                    {
                        entity = !background?ForegroundDebris.FromElement(child) : null;
                    }
                    else if (background)
                    {
                        Console.WriteLine(child.Name);
                    }
                    if (entity != null)
                    {
                        ents.Add(entity);
                    }
                }

                ents.Sort(delegate(Entity one, Entity two) {
                    int comp = two.Depth.CompareTo(one.Depth);
                    return(comp == 0 ? one.ID.CompareTo(two.ID) : comp);
                });

                for (int i = 0; i < ents.Count; i++)
                {
                    Entity entity = ents[i];
                    entity.Render(g, solids);
                }
            }
        }
Ejemplo n.º 11
0
 private static bool onJumpthruHasPlayerRider(On.Celeste.JumpThru.orig_HasPlayerRider orig, JumpThru self)
 {
     if (self is UpsideDownJumpThru)
     {
         // upside-down jumpthrus never have a player rider because... well, they're upside-down.
         return(false);
     }
     return(orig(self));
 }