private void ApplyGravity() { var touchesFluid = ActiveElements.GetActiveFluids(position).Any(s => Collide(s)); if (moveDefiner.key(command.Jump) && Grounded) { Grounded = false; speed = touchesFluid ? Parameters.WaterJumpSpeed : Parameters.MaxFallSpeed; } foreach (var block in ActiveElements.GetActiveToppings(position)) { if (Collide(block) && TicksElapsed >= Parameters.BlocksCollisionDelay) { Grounded = true; if (speed < 0) { speed = 0; } status.DealDamage(DistanceFalled); DistanceFalled = 0; break; } } move(roation.Up, speed); ChangeMoveSpeed(touchesFluid); }
private void CheckIfTouchesFluid(BlockType lava) { if (ActiveElements.GetActiveFluids(position).FindAll(s => s.Id == lava).Any(s => Collide(s))) { status.DealDamageFromLava(); } }
public void CheckIfUnderwater() { foreach (var item in ActiveElements.GetActiveFluids(position)) { if (Collide(item)) { if (!IsInWater) { Sound.PlaySound(SoundType.WaterEnter); IsInWater = true; } WaterTicks++; if (WaterTicks > 19) { status.DealBreathBuuble(); WaterTicks = 0; } return; } } if (IsInWater) { Sound.PlaySound(SoundType.WaterExit); IsInWater = false; } status.RestoreBreath(); }