コード例 #1
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            Player = other.gameObject.GetComponent <Adventurer>();
            Player.GetComponent <Movement>().enabled = false;

            UI.ItemUI.enabled = true;

            if (weapon != null)
            {
                UI.ItemNameLabel.text = weapon.name;
                UI.ItemDescLabel.text = weapon.description;
                UI.EquipButton.onClick.AddListener(EquipItem);
                UI.DiscardButton.onClick.AddListener(DiscardItem);
            }
            else if (armor != null)
            {
                UI.ItemNameLabel.text = armor.name;
                UI.ItemDescLabel.text = armor.description;
                UI.EquipButton.onClick.AddListener(EquipItem);
                UI.DiscardButton.onClick.AddListener(DiscardItem);
            }
        }
    }
コード例 #2
0
    public void EquipItem()
    {
        if (weapon != null)
        {
            Player.weapon = weapon;
        }
        else if (armor != null)
        {
            Player.armor = armor;
        }


        Player.ResetHealth();
        Player.GetComponent <Movement>().enabled = true;
        UI.ItemUI.enabled = false;
        Destroy(gameObject);
    }
コード例 #3
0
 private void SetDaysToComplete(int daysToComplete)
 {
     this.daysToComplete.text = _adventurer.GetComponent <Adventurer>().quest.name + "\n" + "Days To Complete" + "\n" + daysToComplete.ToString();
 }