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) { 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); }