//Function used to change the weapon at the given slot to the new one
    public void ChangeWeaponItem(CharacterHands handSlot_, Weapon weaponToChangeTo_)
    {
        if (handSlot_ == CharacterHands.Right)
        {
            this.rightHand = weaponToChangeTo_;

            //If the slot isn't empty, this inventory becomes the item's parent
            if (weaponToChangeTo_ != null)
            {
                weaponToChangeTo_.transform.SetParent(this.transform);
            }
        }
        else if (handSlot_ == CharacterHands.Left)
        {
            this.leftHand = weaponToChangeTo_;

            //If the slot isn't empty, this inventory becomes the item's parent
            if (weaponToChangeTo_ != null)
            {
                weaponToChangeTo_.transform.SetParent(this.transform);
            }
        }

        //Updating this inventory's weight
        this.FindArmorStats();
    }
예제 #2
0
 private void Awake()
 {
     if (Camera.main != null)
     {
         _cameraTransform = Camera.main.GetComponent <Transform>();
     }
     _transform      = GetComponent <Transform>();
     rigidbody       = GetComponent <Rigidbody>();
     _characterHands = GetComponent <CharacterHands>();
 }
    //Unequips the weapon in the given slot
    public void UnequipWeapon(CharacterHands handToRemove_)
    {
        switch (handToRemove_)
        {
        case CharacterHands.Right:
            //Making sure there's an equipped weapon and empty slot to put the weapon
            if (this.rightHand != null && PartyGroup.globalReference.inventory.CheckForEmptySlot() > 0)
            {
                //Moves the current right hand weapon to the inventory and nulls the hand slot
                PartyGroup.globalReference.inventory.AddItemToInventory(this.rightHand.GetComponent <Item>());

                //If this character is holding a 2-handed weapon, the left hand is freed as well
                if (this.rightHand.size == WeaponSize.TwoHands)
                {
                    this.leftHand = null;
                }

                this.rightHand = null;
            }
            break;

        case CharacterHands.Left:
            //Making sure there's an equipped weapon and empty slot to put the weapon
            if (this.leftHand != null && PartyGroup.globalReference.inventory.CheckForEmptySlot() > 0)
            {
                //Moves the current left hand weapon to the inventory and nulls the hand slot
                PartyGroup.globalReference.inventory.AddItemToInventory(this.leftHand.GetComponent <Item>());
                this.leftHand = null;
            }
            break;

        case CharacterHands.Both:
            //Calls this function twice, but with the other hands
            this.UnequipWeapon(CharacterHands.Right);
            this.UnequipWeapon(CharacterHands.Left);
            break;
        }

        //Finding the new inventory weight
        this.FindArmorStats();
    }
예제 #4
0
 void Start()
 {
     rb        = GetComponent <Rigidbody>();
     hands     = GetComponent <CharacterHands>();
     character = GetComponent <BaseCharacterController>();
 }
예제 #5
0
 public virtual void OnUnequip(CharacterHands characterHands)
 {
     rigidbody.isKinematic = false;
 }
예제 #6
0
 public virtual void OnEquip(CharacterHands characterHands)
 {
     rigidbody.isKinematic = true;
 }
예제 #7
0
 public virtual void ActivateEffect(CharacterHands characterHands)
 {
 }
예제 #8
0
    public override void OnUnequip(CharacterHands characterHands)
    {
        base.OnUnequip(characterHands);

        characterHands.GetComponent <BaseCharacterController>().hasDoubleJump = false;
    }