Beispiel #1
0
 void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         campUI.SetActive(true);
         campUI.GetComponent <TextMeshProUGUI>().text = "Press E to Heal.";
         if (Input.GetButton("Interact"))
         {
             //Debug.Log("pressed");
             NumberTracker playerNums = other.gameObject.GetComponent <NumberTracker>();
             playerNums.heal(playerNums.healthMax);
             AmmoTracker ammo = playerNums.GetComponentInChildren <AmmoTracker>();
             ammo.reload();
         }
     }
 }
Beispiel #2
0
    void OnTriggerStay(Collider other)
    {
        MainRoom      parentRoom = GetComponentInParent <MainRoom>();
        NumberTracker playerNums = other.gameObject.GetComponent <NumberTracker>();

        if (!doorText.activeSelf && other.gameObject.tag == "Player" && parentRoom.roomState == "Empty" && playerNums.campCount >= 1)
        {
            campUI.SetActive(true);
            campUI.GetComponent <TextMeshProUGUI>().text = "Press E to Place A Camp.";
            if (Input.GetButton("Interact"))
            {
                campUI.SetActive(false);
                parentRoom.campSwitch();
                playerNums.campCount--;
            }
        }
        else if (doorText.activeSelf && other.gameObject.tag == "Player")
        {
            campUI.SetActive(false);
        }
    }