public MarioPlayer() { PreviousAnimationState = null; CurrentPowerState = new MarioSmallState(this); CurrentAnimationState = new MarioRightIdleState(this); MarioPhysics = new MarioPhysicalProperty(this); Rectangle = new Rectangle((int)Location.X, (int)Location.Y, CurrentAnimationState.Width, CurrentAnimationState.Height); IsIdle = true; isAlive = true; isFlash = false; canKick = true; starTimer = Util.Instance.Zero; damageTimer = Util.Instance.Zero; deathTimer = Util.Instance.Zero; Scores = Util.Instance.Zero; lifes = Util.Instance.Int_3; fireballs = new List <Fireball>(); fireballPhysicalProperties = new List <FireballPhysicalProperty>(); ScoreObjects = new List <ScoreObject>(); canTakeDamage = true; resetWorld = false; CanStandOnBlock = true; canFallDie = true; Coefficient = Util.Instance.Int_1; }
public void TakeDamage() { if (canTakeDamage && !(CurrentPowerState is MarioSmallState)) { CurrentPowerState = new MarioSmallState(this); CurrentAnimationState = new MarioRightIdleState(this); Location += new Vector2(Util.Instance.Zero, Util.Instance.Int_15); isAlive = true; isFlash = true; canTakeDamage = false; } if (canTakeDamage && CurrentPowerState is MarioSmallState) { lifes--; SoundManager.Instance.PlayPlayerDeadMusic(); isAlive = false; canTakeDamage = false; } }