public override void Update() { base.Update(); if (Charge > 0 && base.Scene.OnInterval(fresh ? 0.5f : 0.1f)) { bool collided = false; foreach (FakeWall wall in Scene.Tracker.GetEntities <FakeWall>()) { if (wall.Collider.Collide(this)) { collided = true; } } if (!collided) { Level.ParticlesFG.Emit(particle, Hold.IsHeld ? 2 : 1, Position + particleOffset, Vector2.One * 5f); } } if (dead) { return; } if (swatTimer > 0f) { swatTimer -= Engine.DeltaTime; } hardVerticalHitSoundCooldown -= Engine.DeltaTime; base.Depth = 100; if (base.Scene.OnInterval(0.5f) && Running && Charge > 0) { Charge -= DischargeRate / 2; } string newSprite; ParticleType newParticle = P_Low; if (DischargeRate == 0) { newSprite = "infinite"; newParticle = P_Infinite; } else if (fresh && Charge == MaxCharge) { newSprite = "fresh"; newParticle = P_Full; } else if (Charge > MaxCharge / 2) { newSprite = "full"; newParticle = P_Full; } else if (Charge > MaxCharge / 5) { newSprite = "half"; newParticle = P_Half; } else if (Charge > 0) { newSprite = "low"; newParticle = P_Low; } else { newSprite = "empty"; } if (sprite.CurrentAnimationID != newSprite) { sprite.Play(newSprite); particle = newParticle; if (newSprite == "empty") { Audio.Play("event:/classic/sfx0", Position); Level.ParticlesFG.Emit(particle, 30, Position + particleOffset, Vector2.One * 10f); } else if (newSprite != "infinite" && newSprite != "full" && newSprite != "fresh") { Audio.Play("event:/classic/sfx1", Position); } } if (Hold.IsHeld) { if (!Running) { Running = true; fresh = false; } prevLiftSpeed = Vector2.Zero; LastHeld = this; } else { if (OnGround()) { float target = (!OnGround(Position + Vector2.UnitX * 3f)) ? 20f : (OnGround(Position - Vector2.UnitX * 3f) ? 0f : (-20f)); Speed.X = Calc.Approach(Speed.X, target, 800f * Engine.DeltaTime); Vector2 liftSpeed = base.LiftSpeed; if (liftSpeed == Vector2.Zero && prevLiftSpeed != Vector2.Zero) { Speed = prevLiftSpeed; prevLiftSpeed = Vector2.Zero; Speed.Y = Math.Min(Speed.Y * 0.6f, 0f); if (Speed.X != 0f && Speed.Y == 0f) { Speed.Y = -60f; } if (Speed.Y < 0f) { noGravityTimer = 0.15f; } } else { prevLiftSpeed = liftSpeed; if (liftSpeed.Y < 0f && Speed.Y < 0f) { Speed.Y = 0f; } } } else if (Hold.ShouldHaveGravity) { float num = 800f; if (Math.Abs(Speed.Y) <= 30f) { num *= 0.5f; } float num2 = 350f; if (Speed.Y < 0f) { num2 *= 0.5f; } Speed.X = Calc.Approach(Speed.X, 0f, num2 * Engine.DeltaTime); if (noGravityTimer > 0f) { noGravityTimer -= Engine.DeltaTime; } else { Speed.Y = Calc.Approach(Speed.Y, 200f, num * Engine.DeltaTime); } } previousPosition = base.ExactPosition; MoveH(Speed.X * Engine.DeltaTime, onCollideH); MoveV(Speed.Y * Engine.DeltaTime, onCollideV); if (base.Right > (float)Level.Bounds.Right) { base.Right = Level.Bounds.Right; CollisionData data = new CollisionData { Direction = Vector2.UnitX }; OnCollideH(data); } else if (base.Left < (float)Level.Bounds.Left) { base.Left = Level.Bounds.Left; CollisionData data = new CollisionData { Direction = -Vector2.UnitX }; OnCollideH(data); } else if (base.Bottom > (float)Level.Bounds.Bottom && SaveData.Instance.Assists.Invincible) { base.Bottom = Level.Bounds.Bottom; Speed.Y = -300f; Audio.Play("event:/game/general/assist_screenbottom", Position); } else if (base.Top > (float)Level.Bounds.Bottom) { RemoveSelf(); } Player entity = base.Scene.Tracker.GetEntity <Player>(); BatteryGate templeGate = CollideFirst <BatteryGate>(); if (templeGate != null && entity != null) { templeGate.Collidable = false; MoveH((float)(Math.Sign(entity.X - base.X) * 32) * Engine.DeltaTime); templeGate.Collidable = true; } } if (!dead) { foreach (BatteryCollider batteryCollider in base.Scene.Tracker.GetComponents <BatteryCollider>()) { batteryCollider.Check(this); } Hold.CheckAgainstColliders(); if (!ignoreBarriers) { foreach (SeekerBarrier entity in base.Scene.Tracker.GetEntities <SeekerBarrier>()) { entity.Collidable = true; bool flag = CollideCheck(entity); entity.Collidable = false; if (flag) { entity.OnReflectSeeker(); Die(); } } } } if (hitSeeker != null && swatTimer <= 0f && !hitSeeker.Check(Hold)) { hitSeeker = null; } }