private void OnPuffer(Puffer p) { if (p.HitSpring(GetFakeSpring())) { BounceAnimate(); } }
public static bool PufferCanEnterPipe(Entity entity, Direction direction) { Puffer puffer = entity as Puffer; if (puffer != null) { Vector2 speed = (Vector2)hitSpeedField.GetValue(puffer); switch (direction) { case Direction.Left: return(speed.X > 0); case Direction.Right: return(speed.X < 0); case Direction.Up: return(speed.Y > 0); case Direction.Down: return(speed.Y < 0); default: return(false); } } return(false); }
public void SpawnFish() { if (currentLevel == null) { return; } for (int i = 0; i < 100; i++) { int x = rand.Next(currentLevel.Bounds.Width) + currentLevel.Bounds.X; int y = rand.Next(currentLevel.Bounds.Height) + currentLevel.Bounds.Y; // should be at least 100 pixels from the player double playerDistance = Math.Sqrt(Math.Pow(MathHelper.Distance(x, ply.X), 2) + Math.Pow(MathHelper.Distance(y, ply.Y), 2)); // also check if we are not spawning in a wall, that would be a shame Rectangle collideRectangle = new Rectangle(x - 8, y - 8, 16, 16); if (playerDistance > 25 && !currentLevel.CollideCheck <Solid>(collideRectangle)) { // build a Seeker with a proper EntityID to make Speedrun Tool happy (this is useless in vanilla Celeste but the constructor call is intercepted by Speedrun Tool) EntityData seekerData = generateBasicEntityData(currentLevel, 10 + 1); seekerData.Position = new Vector2(x, y); Puffer puffer = new Puffer(seekerData, Vector2.Zero); currentLevel.Add(puffer); break; } } }
private void Puffer_Render(On.Celeste.Puffer.orig_Render orig, Puffer self) { if (GameplayRendererExt.RenderDebug) { Draw.Circle(self.Position, 32f, Color.Red, 32); } orig(self); }
public static void PufferOnPipeExit(Entity entity, MarioClearPipeInteraction interaction) { Puffer puffer = entity as Puffer; if (puffer != null) { gotoHitSpeedMethod.Invoke(puffer, new Object[] { interaction.DirectionVector *interaction.TravelSpeed }); } }
private void OnPuffer(Puffer p) { if (p.HitSpring(this)) { Vector2 pufferSpeed = (Vector2)Puffer_hitSpeed.GetValue(p); Puffer_hitSpeed.SetValue(p, pufferSpeed * speedMult); BounceAnimate(); TryBreak(); } }
private static void onPufferExplode(On.Celeste.Puffer.orig_Explode orig, Puffer self) { orig(self); // make the puffer check for flag touch switches as well. Collider oldCollider = self.Collider; self.Collider = (Collider)pufferPushRadius.GetValue(self); turnOnTouchSwitchesCollidingWith(self); self.Collider = oldCollider; }
public override bool AddInteraction(Entity entity) { Puffer puffer = entity as Puffer; if (puffer != null && !HasClearPipeInteraction(entity)) { MarioClearPipeInteraction interaction = new MarioClearPipeInteraction(Vector2.Zero); interaction.OnPipeBlocked = PufferOnPipeBlocked; interaction.OnPipeEnter = PufferOnPipeEnter; interaction.OnPipeExit = PufferOnPipeExit; interaction.OnPipeUpdate = PufferOnPipeUpdate; interaction.CanEnterPipe = PufferCanEnterPipe; entity.Add(interaction); return(true); } return(false); }
private static void DrawPufferHitbox(Puffer puffer) { Vector2 bottomCenter = puffer.BottomCenter - Vector2.UnitY * 1; if (puffer.Scene.Tracker.GetEntity <Player>() is { Ducking : true })
private void patchPufferExplode(On.Celeste.Puffer.orig_Explode orig, Puffer self) { swapNoRefillsTemporarily(() => orig(self), self.SceneAs <Level>().Session); }