예제 #1
0
파일: Mario.cs 프로젝트: Sway623/Mario-3902
        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;
                }
            }
        }
예제 #2
0
 public void Update(GameTime gameTime)
 {
     if (starTimer != 0 & isStar)
     {
         starTimer--;
     }
     if (starTimer == 0)
     {
         isStar    = false;
         starTimer = ValueHolder.maxStarTime;
         if (!isNinja)
         {
             SoundManager.PlaySong(SoundManager.songs.overworld);
         }
         else
         {
             SoundManager.PlaySong(SoundManager.songs.ninja);
         }
     }
     if (ninjaTimer != 0 & isNinja)
     {
         ninjaTimer--;
     }
     if (ninjaTimer == 0)
     {
         isNinja    = false;
         ninjaTimer = ValueHolder.maxNinjaTime;
         if (!isStar)
         {
             SoundManager.PlaySong(SoundManager.songs.overworld);
         }
         else
         {
             SoundManager.PlaySong(SoundManager.songs.star);
         }
     }
     if (invicibilityFrames != 0)
     {
         invicibilityFrames--;
     }
     if (projectileTimer != 0)
     {
         projectileTimer--;
     }
     else
     {
         projectileTimer = ValueHolder.projectileDelay;
     }
     state.Update(gameTime);
     physState.Update(gameTime);
 }