Exemplo n.º 1
0
        /// <summary>
        /// Set the Shoes's position to the position of the Guy if the collision delay timer is completed and the Guy and Shoes are not currently linked.
        /// </summary>
        /// <param name="shoes">A reference to the Shoes.</param>
        private void setShoesPositionToGuyUponCollisionIfPossible(Shoes shoes)
        {
            if (PositionRect.Intersects(shoes.PositionRect) && !delayCollisionWithShoesAndGuy && !areGuyAndShoesCurrentlyLinked)
            {
                velocity                      = new Vector2(0f, 0f);
                shoes.velocity                = new Vector2(0f, 0f);
                shoes.Position                = new Vector2(Position.X, Position.Y + 40);
                isGuyBeingShot                = false;
                shoes.stopPlayerInput         = true;
                idleAnimationLockIsOn         = false;
                delayCollisionWithShoesAndGuy = true;
                areGuyAndShoesCurrentlyLinked = true;
                shoes.swapTexture(areGuyAndShoesCurrentlyLinked);
                SoundEffectHandler.stopShoesRunningEffect();

                if (shoes.directionShoesAreRunning == State.Running_Left || shoes.directionShoesAreRunning == State.Idle_Left)
                {
                    shoes.changeSpriteOfTheShoes("Idle_Left", true);
                    changeSpriteOfTheGuy("Empty");
                }
                else if (shoes.directionShoesAreRunning == State.Running_Right || shoes.directionShoesAreRunning == State.Idle_Right)
                {
                    shoes.changeSpriteOfTheShoes("Idle_Right", true);
                    changeSpriteOfTheGuy("Empty");
                }
            }
        }