//-----------------------------------------------------------------------------
 // Constructors
 //-----------------------------------------------------------------------------
 public PlayerHoldSwordState()
 {
     weaponAnimation	= GameData.ANIM_SWORD_HOLD;
     nextState		= null;
     weapon			= null;
     chargeTimer		= 0;
     direction		= Directions.Right;
     playerTool		= null;
 }
示例#2
0
        // Equip a weapon into the given slot (slot 0 (A) or 1 (B)).
        public void EquipWeapon(Item item, int slot)
        {
            ItemWeapon weapon = item as ItemWeapon;

            if (weapon != null && weapon.HasFlag(ItemFlags.TwoHanded))
            {
                // Unequip the current items.
                if (equippedWeapons[0] != null)
                {
                    equippedWeapons[0].Unequip();
                }
                if (equippedWeapons[1] != null)
                {
                    equippedWeapons[1].Unequip();
                }

                equippedWeapons[0] = weapon;
                equippedWeapons[1] = weapon;
            }
            else
            {
                // Unequip the current item.
                if (equippedWeapons[slot] != null)
                {
                    if (equippedWeapons[slot].IsTwoHanded)
                    {
                        equippedWeapons[1 - slot] = null;
                    }
                    equippedWeapons[slot].Unequip();
                }

                equippedWeapons[slot] = weapon;
            }

            // Equip the new item.
            if (weapon != null)
            {
                weapon.CurrentEquipSlot = slot;
                weapon.Equip();
            }
        }
 //-----------------------------------------------------------------------------
 // Overridden methods
 //-----------------------------------------------------------------------------
 public override void OnSwordHit(ItemWeapon swordItem)
 {
     Toggle();
 }
        //-----------------------------------------------------------------------------
        // Constructors & Setup
        //-----------------------------------------------------------------------------
        public PlayerSwingState()
        {
            weapon = null;
            timedActions = new Dictionary<int, Action>();

            InitStandardSwing(GameData.ANIM_SWORD_SWING, GameData.ANIM_SWORD_MINECART_SWING);
        }
 //-----------------------------------------------------------------------------
 // Constructors
 //-----------------------------------------------------------------------------
 public PlayerSwordStabState()
 {
     this.weapon = null;
     this.continueHolding = true;
 }
示例#6
0
 // Called when the player hits this tile with the sword.
 public virtual void OnSwordHit(ItemWeapon swordItem)
 {
     int minLevel = properties.GetInteger("cuttable_sword_level", Item.Level1);
     if (!isMoving && flags.HasFlag(TileFlags.Cuttable) &&
         (!(swordItem is ItemSword) || swordItem.Level >= minLevel))
     {
         Break(true);
     }
 }