void OnTriggerEnter(Collider other) { if (!enable) { return; } if (other.tag == "Player") { CalculatePos(other.transform.position); if (direction > 0 && target == null) { float eulerX = cam.pivotX.transform.localEulerAngles.x; while (eulerX > 180.0f) { eulerX -= 360.0f; } activated = true; if (requireEntryAngle && (Mathf.Abs(activateEntryAngle - eulerX) > THRESHOLD)) { activated = false; return; } target = other.gameObject; saveX = eulerX; colPoint = other.gameObject.transform.position; ds.storeFloatValue(this.gameObject.name + level.locationName + "SaveX", saveX); ds.storeFloatValue(this.gameObject.name + level.locationName + "pointX", colPoint.x); ds.storeFloatValue(this.gameObject.name + level.locationName + "pointY", colPoint.y); ds.storeFloatValue(this.gameObject.name + level.locationName + "pointZ", colPoint.z); ds.storeBoolValue(this.gameObject.name + level.locationName + "HaveTarget", true); controller.SaveLastTrigger(this.gameObject, level.locationName); } if (direction < 0 && target != null) { cam.setTargetX(saveX, 1); target = null; ds.storeBoolValue(this.gameObject.name + level.locationName + "HaveTarget", false); controller.NextLastTrigger(level.locationName); } } }
void OnTriggerEnter(Collider other) { Debug.Log("<color=yellow>SetCameraFollowDirection</color>"); if (other.tag == "Player") { CalculatePos(other.transform.position); if (direction > 0 && target == null) { float eulerY = cam.pivotY.transform.localEulerAngles.y; while (eulerY > 180.0f) { eulerY -= 360.0f; } activated = true; if (requireEntryAngle && (Mathf.Abs(activateEntryAngle - eulerY) > THRESHOLD)) { activated = false; return; } target = other.gameObject; saveY = eulerY; colPoint = other.gameObject.transform.position; ds.storeFloatValue(this.gameObject.name + level.locationName + "SaveY", saveY); ds.storeFloatValue(this.gameObject.name + level.locationName + "pointX", colPoint.x); ds.storeFloatValue(this.gameObject.name + level.locationName + "pointY", colPoint.y); ds.storeFloatValue(this.gameObject.name + level.locationName + "pointZ", colPoint.z); ds.storeBoolValue(this.gameObject.name + level.locationName + "HaveTarget", true); controller.SaveLastTrigger(this.gameObject, level.locationName); } if (direction < 0 && target != null) { cam.setTargetY(saveY, 1); target = null; ds.storeBoolValue(this.gameObject.name + level.locationName + "HaveTarget", false); controller.NextLastTrigger(level.locationName); } } }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { if (target == null) { target = other.gameObject; //saveY = cam.pivotY.transform.localEulerAngles.y; enter = true; ds.storeBoolValue(this.gameObject.name + level.locationName + "Enter", enter); colPoint = other.gameObject.transform.position; //ds.storeFloatValue (this.gameObject.name + level.locationName + "SaveY", saveY); ds.storeFloatValue(this.gameObject.name + level.locationName + "pointX", colPoint.x); ds.storeFloatValue(this.gameObject.name + level.locationName + "pointY", colPoint.y); ds.storeFloatValue(this.gameObject.name + level.locationName + "pointZ", colPoint.z); ds.storeBoolValue(this.gameObject.name + level.locationName + "HaveTarget", true); controller.SaveLastTrigger(this.gameObject, level.locationName); } } }