public void DropEquippedItem() { Debug.Log("drop item: " + currentlyEquippedItem.id); if (currentlyEquippedItem.id != equippableItemID.HORSE_ON_LEAD && currentlyEquippedItem.id != equippableItemID.HORSE_MOUNTED) { currentlyEquippedItem.transform.position = new Vector3(dropItemPos.position.x, dropItemPos.position.y + currentlyEquippedItem.dropPosYOffset, dropItemPos.position.z); } currentlyEquippedItem.transform.SetParent(null); currentlyEquippedItem.BeDropped(); if (currentlyEquippedItem.id == equippableItemID.HORSE_ON_LEAD) { Horse_Interactable horseInt = currentlyEquippedItem.GetComponent <Horse_Interactable> (); if (horseInt.headGear.type == horseGearType.HALTER) { horseInt.LeadIsDropped(this); } else if (horseInt.headGear.type == horseGearType.BRIDLE) { horseInt.StopLeadingHorseByReins(this); } } else if (currentlyEquippedItem.id == equippableItemID.HORSE_MOUNTED) { Horse_Interactable horseInt = currentlyEquippedItem.GetComponent <Horse_Interactable> (); horseInt.Dismount(this); currentMovementSet = playerMovementSet.WALKING; } maximumTurnRate = defaultMaximumTurnRate; Debug.Log("calling removeitem from Drop"); inventory.RemoveActiveItemFromInventory(currentlyEquippedItem); currentlyEquippedItem = playerHands; }
private void InitReferences() { horseBehavior = GetComponent <Horse_Behavior> (); if (horseBehavior == null) { Debug.Log("No horseBehavior on " + name); } else { horseBehavior.horse = this; } horseInteractable = GetComponent <Horse_Interactable> (); if (horseInteractable == null) { Debug.Log("No horseInteractable on " + name); } else { horseInteractable.horse = this; } horseStats = GetComponent <Horse_Stats> (); if (horseStats == null) { Debug.Log("No horseStats on " + name); } else { horseStats.horse = this; } horseRidingBehavior = GetComponent <Horse_RidingBehavior> (); if (horseRidingBehavior == null) { Debug.Log("No horseRidingBehavior on " + name); } else { horseRidingBehavior.horse = this; } horseAnimator = GetComponentInChildren <Animator> (); if (horseAnimator == null) { Debug.Log("No horseAnimator on " + name); } }
//let horse loose from post (lead keeps hanging here) private void TakeHorseFromPost(Player player) { horseTiedHere.TakeHorseFromPost(player); horseTiedHere = null; }
private void TieHorseToPost(Player player) { //only parenting, bc horse on lead is same as horse on post? horseTiedHere = player.currentlyEquippedItem.GetComponent <Horse_Interactable>(); horseTiedHere.TieHorseToPost(player); }