protected virtual void OnTriggerExit(Collider other) {/* * Debug.Log("OTHER ELEMENT OnTriggerExit: " + other.gameObject); * * if (other.tag == "Overlap" && (state == ElementState.MOVE || state == ElementState.ROTATE)) * { * overlappedElements--; * if (overlappedElements == 0) * { * ChangeError(ErrorState.NONE); * } * }*/ AbstractOpticalElement opticalElement = other.gameObject.GetComponent <AbstractOpticalElement>(); Lampport lampPort = other.gameObject.GetComponent <Lampport>(); StartLens startLens = other.gameObject.GetComponent <StartLens>(); // Ended Collision with another OpticalElement or Lampport if (opticalElement || lampPort || startLens) { if (overlappedElements == 0 && (state == ElementState.MOVE || state == ElementState.ROTATE)) { overlappedElements--; ChangeError(ErrorState.NONE); } } }
public virtual void OnTriggerEnter(Collider other) {/* * Debug.Log("ontriggerenter"); * Debug.Log("OTHER ELEMENT OnTriggerEnter: " + other.gameObject); * * if (other.tag == "Overlap" && (state == ElementState.MOVE || state == ElementState.ROTATE)) * { * overlappedElements++; * ChangeError(ErrorState.ERROROVERLAP); * }*/ AbstractOpticalElement opticalElement = other.gameObject.GetComponent <AbstractOpticalElement>(); Lampport lampPort = other.gameObject.GetComponent <Lampport>(); StartLens startLens = other.gameObject.GetComponent <StartLens>(); // Collision with another OpticalElement or Lampport if (opticalElement || lampPort || startLens) { if (overlappedElements == 0 && (state == ElementState.MOVE || state == ElementState.ROTATE)) { overlappedElements++; ChangeError(ErrorState.ERROROVERLAP); } } }