コード例 #1
0
 /// <summary>
 /// Clear all the collisions for each collider
 /// </summary>
 protected override void ClearCollisions()
 {
     base.ClearCollisions();
     CollAbove.ResetCollider();
     CollBelow.ResetCollider();
     CollLeft.ResetCollider();
     CollRight.ResetCollider();
     CollCenter.ResetCollider();
 }
コード例 #2
0
 public override void Update(GameTime gameTime)
 {
     //Update the rest of the colliders as well
     CollAbove.Update(gameTime);
     CollBelow.Update(gameTime);
     CollLeft.Update(gameTime);
     CollRight.Update(gameTime);
     CollCenter.Update(gameTime);
     base.Update(gameTime);
 }
コード例 #3
0
        /// <summary>
        /// Check for a collision with water when we're not swimming
        /// </summary>
        /// <param name="other">Collider to check with</param>
        private void CheckForWaterWhenNotSwimming()
        {
            if (CollCenter.CollidingWith <Water>())
            {
                state        = PlayerState.InWater;
                Acceleration = .05f * airAcceleration;
                Velocity.Y   = MathHelper.Clamp(Velocity.Y, -MoveSpeed, MoveSpeed);

                //Turn blue to match water
                DrawColor = Color.Blue;

                //Loop ambient swim noise
                GameManager.LoopSFX("WaterLoop");
            }
        }