示例#1
0
        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);
        }
示例#2
0
 private void CheckIfTouchesFluid(BlockType lava)
 {
     if (ActiveElements.GetActiveFluids(position).FindAll(s => s.Id == lava).Any(s => Collide(s)))
     {
         status.DealDamageFromLava();
     }
 }
示例#3
0
 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();
 }