private void TakeOffHalter(Player player) { Equippable halterEquippable = headGear.GetComponent <Equippable> (); headGear = null; player.EquipAnItem(halterEquippable); halterEquippable.BeEquipped(); }
private void TakeOffBridle(Player player) { headGear.anim.Play("Still"); Equippable bridleEquippable = headGear.GetComponent <Equippable> (); headGear = null; player.EquipAnItem(bridleEquippable); bridleEquippable.BeEquipped(); }
private void PutOnBridle(Player player) { headGear = player.currentlyEquippedItem.GetComponent <HorseGear> (); player.UnequipEquippedItem(); headGear.transform.position = bridleTransform.position; headGear.transform.rotation = bridleTransform.rotation; headGear.transform.SetParent(bridleTransform); headGear.anim.Play("OnHorse"); GenericUtilities.EnableAllColliders(headGear.transform, false); }
private void TakeOffSaddleAndPad(Player player) { Equippable saddleEquippable = backGear.GetComponent <Equippable> (); backGear.girth.position = backGear.girthPosHanging.position; backGear.girth.rotation = backGear.girthPosHanging.rotation; backGear = null; player.EquipAnItem(saddleEquippable); saddleEquippable.BeEquipped(); }
private void PutOnLead(Player player) { headGearAttachment = player.currentlyEquippedItem.GetComponent <HorseGear> (); player.UnequipEquippedItem(); headGearAttachment.transform.position = leadTransformLeading.position; headGearAttachment.transform.rotation = leadTransformLeading.rotation; headGearAttachment.transform.SetParent(leadTransformLeading); GenericUtilities.EnableAllColliders(headGearAttachment.transform, false); StartLeadingHorse(player); }
private void PutOnSaddleAndPad(Player player) { backGear = player.currentlyEquippedItem.GetComponent <HorseGear> (); backGear.girth.position = backGear.girthPosOnHorse.position; backGear.girth.rotation = backGear.girthPosOnHorse.rotation; player.UnequipEquippedItem(); backGear.transform.position = saddleTransform.position; backGear.transform.rotation = saddleTransform.rotation; backGear.transform.SetParent(saddleTransform); GenericUtilities.EnableAllColliders(backGear.transform, false); }
private void TakeOffLead(Player player) { headGearAttachment.anim.Play("Still"); Equippable leadEquippable = headGearAttachment.GetComponent <Equippable> (); headGearAttachment = null; player.UnequipEquippedItem(); player.EquipAnItem(leadEquippable); leadEquippable.BeEquipped(); horseOnLeadEquippable.EnableAllColliders(true); StopLeadingHorse(player); }
private void TakeOffHalterAndLead(Player player) { //find combined equippable, which is a child of Halter (but hierarchy changes, so it's not always the 0th child) Equippable combinedEquippable = null; Equippable[] equippablesInHalter = headGear.GetComponentsInChildren <Equippable> (); for (int i = 0; i < equippablesInHalter.Length; ++i) { if (equippablesInHalter [i].id == equippableItemID.HALTER_WITH_LEAD) { combinedEquippable = equippablesInHalter [i]; } } headGearAttachment.anim.Play("Still"); headGearAttachment.transform.SetParent(combinedEquippable.transform); player.UnequipEquippedItem(); player.EquipAnItem(combinedEquippable); combinedEquippable.BeEquipped(); StopLeadingHorse(player); Debug.Log("combined was equipped"); headGear.transform.SetParent(combinedEquippable.transform); headGearAttachment = null; headGear = null; foreach (Transform child in combinedEquippable.transform) { //fix positions child.position = player.equippedItemPos.position; child.localEulerAngles = player.currentlyEquippedItem.equippedRotation; child.localPosition = child.GetComponent <Equippable>().equippedOffset; } horseOnLeadEquippable.EnableAllColliders(true, true); combinedEquippable.EnableAllColliders(false, true); }
private void PutOnHalterAndLead(Player player) { //store this here so that I can still access it once it's been unequipped Equippable combinedEquippable = player.currentlyEquippedItem; foreach (Transform child in player.currentlyEquippedItem.transform) { Debug.Log("equipping " + child); horseGearType type = child.GetComponent <HorseGear> ().type; switch (type) { case horseGearType.HALTER: headGear = child.GetComponent <HorseGear> (); headGear.transform.position = halterTransform.position; headGear.transform.rotation = halterTransform.rotation; GenericUtilities.EnableAllColliders(headGear.transform, false); break; case horseGearType.LEAD: headGearAttachment = child.GetComponent <HorseGear> (); headGearAttachment.transform.position = leadTransformLeading.position; headGearAttachment.transform.rotation = leadTransformLeading.rotation; GenericUtilities.EnableAllColliders(headGearAttachment.transform, false); break; } } headGear.transform.SetParent(halterTransform); headGearAttachment.transform.SetParent(leadTransformLeading); player.UnequipEquippedItem(); combinedEquippable.transform.SetParent(headGear.transform); StartLeadingHorse(player); }