// Update is called once per frame void Update() { transform.LookAt(player.transform); CheckDistance(); if (distance <= 2 && onlyOnce == true) { sys.SetAction(action); onlyOnce = false; portalTxt.gameObject.SetActive(true); } if (distance > 2 && onlyOnce == false) { sys.SetAction(0); onlyOnce = true; portalTxt.gameObject.SetActive(false); } }
// Update is called once per frame void Update() { if (sys == null) { sys = FindObjectOfType <EventSys>(); } CheckDistance(); if (distance <= 5 && onlyOnce == true) { sys.SetAction(action); onlyOnce = false; portalTxt.gameObject.SetActive(true); } if (distance > 5 && onlyOnce == false) { sys.SetAction(0); onlyOnce = true; portalTxt.gameObject.SetActive(false); } }
// Update is called once per frame void Update() { if (sys == null) { sys = EventSys.instance; } CheckDistance(); if (distance <= 10 && onlyOnce == true) { sys.SetAction(action); onlyOnce = false; portalTxt.gameObject.SetActive(true); } if (distance > 10 && onlyOnce == false) { sys.SetAction(0); onlyOnce = true; portalTxt.gameObject.SetActive(false); } }