Ejemplo n.º 1
0
 /// <inheritdoc/>
 public void Update()
 {
     sprite.Update();
     if (sprite.CurrentFrame >= GameData.Instance.PlayerConstants.MaximumFrames)
     {
         sprite.SetFrame(0);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UseItemState"/> class.
 /// </summary>
 /// <param name="playerInstance">Instance of player.</param>
 /// <param name="waitTime">Time for player to wait.</param>
 public UseItemState(IPlayer playerInstance, int waitTime)
 {
     player                          = playerInstance;
     lockoutTimer                    = waitTime; // wait period
     sprite                          = CreateCorrectSprite();
     sprite.CurrentFrame             = GameData.Instance.PlayerConstants.MaximumFrames;
     player.Physics.MovementVelocity = Vector2.Zero;
     sprite.SetFrame(GameData.Instance.PlayerConstants.MaximumFrames);
 }
Ejemplo n.º 3
0
 public ProfilesState()
 {
     SoundFactory.Instance.PlayLobbyTune();
     ProfileScreen  = ScreenSpriteFactory.Instance.ProfilesScreen();
     SelectorSprite = LinkSpriteFactory.Instance.CreateSpriteLinkDown(Link.LinkColor.Green);
     SelectorSprite.SetFrame(0);
     string[] profile1 = File.ReadAllLines("Content/Profile1.txt");
     profile1Dungeon = profile1[0];
     string[] profile2 = File.ReadAllLines("Content/Profile2.txt");
     profile2Dungeon = profile2[0];
     string[] profile3 = File.ReadAllLines("Content/Profile3.txt");
     profile3Dungeon = profile3[0];
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AttackState"/> class.
 /// </summary>
 /// <param name="playerInstance">Instance of the player.</param>
 public AttackState(IPlayer playerInstance)
 {
     if (LoZGame.Laser) // laser blast
     {
         player = playerInstance;
         sprite = CreateCorrectLaserSprite();
         SoundFactory.Instance.PlayLaserBlast();
         LoZGame.Instance.GameObjects.Enemies.Clear();
         lockoutTimer = 170; // wait period
         player.Physics.MovementVelocity = Vector2.Zero;
     }
     else
     {
         SoundFactory.Instance.PlaySwordSlash();
         player       = playerInstance;
         lockoutTimer = GameData.Instance.PlayerConstants.LockoutWaitTime; // wait period
         sprite       = CreateCorrectSprite();
         sprite.SetFrame(GameData.Instance.PlayerConstants.MaximumFrames);
         player.Physics.MovementVelocity = Vector2.Zero;
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PickupItemState"/> class.
 /// </summary>
 /// <param name="playerInstance">Instance of player.</param>
 /// <param name="item">Item that player picked up.</param>
 public PickupItemState(IPlayer playerInstance, IItem item)
 {
     player       = playerInstance;
     this.item    = item;
     lockoutTimer = item.PickUpItemTime;
     sprite       = CreateCorrectSprite();
     player.Physics.MovementVelocity = Vector2.Zero;
     if (item is Triforce)
     {
         sprite.SetFrame(GameData.Instance.PlayerConstants.MaximumFrames);
         LoZGame.Instance.GameState.TriforceState();
     }
     else if (item is Key)
     {
         player.Inventory.GainKey();
     }
     else if (item is Bow)
     {
         player.Inventory.HasBow = true;
     }
     else if (item is Arrow)
     {
         if (!player.Inventory.HasArrow)
         {
             player.Inventory.HasArrow = true;
         }
         else
         {
             player.Inventory.GainRupees(10);
         }
     }
     else if (item is SilverArrow)
     {
         player.Inventory.HasSilverArrow = true;
     }
     else if (item is MagicRod)
     {
         player.Inventory.HasRod = true;
     }
     else if (item is Boomerang)
     {
         player.Inventory.HasBoomerang = true;
     }
     else if (item is MagicBoomerang)
     {
         player.Inventory.HasMagicBoomerang = true;
     }
     else if (item is RedCandle)
     {
         player.Inventory.HasRedFlame = true;
     }
     else if (item is BlueCandle)
     {
         player.Inventory.HasBlueFlame = true;
     }
     else if (item is Map)
     {
         player.Inventory.HasMap = true;
     }
     else if (item is Compass)
     {
         player.Inventory.HasCompass = true;
     }
     else if (item is Ladder)
     {
         player.Inventory.HasLadder = true;
     }
     else if (item is Flute)
     {
         player.Inventory.HasFlute = true;
     }
     else if (item is MagicShield)
     {
         player.AcquiredMagicShield      = true;
         player.Inventory.HasMagicShield = true;
     }
     else if (item is MagicKey)
     {
         player.Inventory.HasMagicKey = true;
     }
 }