示例#1
0
        public void Update()
        {
            if (IsDying())
            {
                if (!doneRising && deathCoords.Y - 32 <= location.Y)
                {
                    SetVerticalVelocity(-2);
                }
                else
                {
                    SetVerticalVelocity(2);
                    doneRising = true;
                }
            }
            else if (isTakingDamage)
            {
                bool isFinished = takingDamageManager.ChangeStateAnimation(this);
                if (isFinished)
                {
                    isTakingDamage          = false;
                    inSpecialAnimationState = false;
                }
            }

            if (levelOver && isGrounded)
            {
                inSpecialAnimationState = true;
                endLevelManager.ChangeStateAnimation(this);
            }
            else
            {
                if (location.Y > WorldManager.screenHeight + WorldManager.camera.GetPosition().Y)
                {
                    isDying = true;
                    SetDead(true);
                }

                if (IsInSpecialAnimationState())
                {
                    state.Update();
                }
                else
                {
                    MoveY();

                    marioSprite.Update(isRunning);
                }

                if (StarUtility.isStarMario == false)
                {
                    this.isStarMario = false;
                }
            }
        }
        public void Update(GameTime gameTime)
        {

            Physics.UpdatePosition();
            bool ForceUpdate = false;
            IsMovingVertically = false;
            if (FacingLeft != PreviousDirection || Size != PreviousSize)
            {
                ForceUpdate = true;
                PreviousDirection = FacingLeft;
                PreviousSize = Size;
            }
            getMarioSprite(ForceUpdate);
            

            MarioSprite.Update(gameTime);           
        }