private static bool onKevinMoveHCheck(On.Celeste.CrushBlock.orig_MoveHCheck orig, CrushBlock self, float amount) { IEnumerable <KevinBarrier> kevinBarriers = self.Scene.Tracker.GetEntities <KevinBarrier>().OfType <KevinBarrier>(); foreach (KevinBarrier barrier in kevinBarriers) { barrier.Collidable = true; } bool isHit = orig(self, amount); if (isHit) { self.MoveHCollideSolidsAndBounds(self.Scene as Level, amount, thruDashBlocks: true, (a, b, collidedPlatform) => { if (collidedPlatform is KevinBarrier barrier) { barrier.hitByKevin(); } }); } foreach (KevinBarrier barrier in kevinBarriers) { barrier.Collidable = false; } return(isHit); }
private static bool CrushBlock_MoveHCheck(On.Celeste.CrushBlock.orig_MoveHCheck orig, CrushBlock self, float amount) { float target = self.Position.X + amount; bool chainStop = false; if (self is ChainedKevin chainedKevin) { if (chainedKevin.direction == Directions.Left && target <= chainedKevin.start.X - chainedKevin.chainLength) { chainStop = true; amount = chainedKevin.start.X - chainedKevin.chainLength - self.X; } else if (chainedKevin.direction == Directions.Right && target >= chainedKevin.start.X + chainedKevin.chainLength) { chainStop = true; amount = chainedKevin.start.X + chainedKevin.chainLength - self.X; } if (chainStop) { Audio.Play(CustomSFX.game_chainedFallingBlock_chain_tighten_block, chainedKevin.Center); } return(self.MoveHCollideSolidsAndBounds(self.SceneAs <Level>(), amount, thruDashBlocks: true) || chainStop); } else { return(orig(self, amount)); } }
private static bool OnCrushBlockMoveHCheck(On.Celeste.CrushBlock.orig_MoveHCheck orig, CrushBlock self, float amount) { CrushBlockCollideCheckGroupedFallingBlock(self, amount * Vector2.UnitX); return(orig(self, amount)); }