//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(); }
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(); }
void Start() { rb = GetComponent <Rigidbody>(); hands = GetComponent <CharacterHands>(); character = GetComponent <BaseCharacterController>(); }
public virtual void OnUnequip(CharacterHands characterHands) { rigidbody.isKinematic = false; }
public virtual void OnEquip(CharacterHands characterHands) { rigidbody.isKinematic = true; }
public virtual void ActivateEffect(CharacterHands characterHands) { }
public override void OnUnequip(CharacterHands characterHands) { base.OnUnequip(characterHands); characterHands.GetComponent <BaseCharacterController>().hasDoubleJump = false; }