private void OnTriggerExit2D(Collider2D collision) { viewController = collision.GetComponent <VeiwController>(); if (viewController != null) { viewController.IsCaptured = false; viewController = null; } }
private void OnTriggerEnter2D(Collider2D collision) { viewController = collision.GetComponent <VeiwController>(); if (viewController != null) { viewController.IsCaptured = true; var quest = Quest.GetComponent <IQuest>(); if (quest != null) { quest.RunQuest(); } } }
void Update() { if (!isOpening) { return; } left.transform.position += speed * Time.deltaTime * Vector3.left; right.transform.position += speed * Time.deltaTime * Vector3.right; if ((right.transform.position - left.transform.position).magnitude > 2 * SideSize) { isOpening = false; GetComponent <Collider2D>().enabled = false; if (viewController != null) { viewController.IsCaptured = false; viewController = null; } } }