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);
    }
Пример #2
0
 private void Start()
 {
     //search in children, 'equip' halter or lead if any are there
     content = GetComponentInChildren <Equippable>();
     if (content != null)
     {
         content.EnableAllColliders(false);
         hookStatus = containerStatus.FULL;
     }
     else
     {
         hookStatus = containerStatus.EMPTY;
     }
 }
    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);
    }