private void OnTriggerEnter(Collider other) { ObjectInRange = true; AO = other.gameObject.GetComponent <ActivateObject>(); InteractionPrompt.SetActive(true); if (AO.ObjectCount == 0) { // Testing Object Increase Value AO.ObjectCount += 1; ObjectFinalCount += AO.ObjectCount; // Debug.Log(AO.ObjectCount); // Debug.Log(ObjectFinalCount); } }
void Update() { if (DetectObject.ObjectInRange == true) { _activateObject = DetectObject.AO; } if (Input.GetKeyDown(KeyCode.F) && DetectObject.ObjectInRange == true) // Player must be within an object and press key { activeND.SetActive(true); // Show Display object DisplayText(); } else if (DetectObject.ObjectInRange == false) // Hide Display Object and reset sentence index { activeND.SetActive(false); activeIndex = 0; } }