private PickJacket pickjacket_script; // Load Key Script // Start is called before the first frame update void Start() { UIObject_boat1.SetActive(false); UIObject_boat2.SetActive(false); openboat_script = boatopenerhere.GetComponent <OpenBoat>(); // get "boat is open" value pickjacket_script = hasthejacket.GetComponent <PickJacket>(); // get hasthekey value }
void OnTriggerEnter(Collider other) // colliding with other object { pickjacket_script = hasthejacket.GetComponent <PickJacket>(); // aquires "hasthekey" value if (other.tag == "Player" && pickjacket_script.hasthejacket == false) // if other object is PLAYER + player does NOT have the jacket yet { UIObject_lifejacket.SetActive(true); // show key message } }