void OnTriggerEnter(Collider other) { if (cameraInside) { return; } // Check if other collider has the main camera attached if (other == targetCollider || other.gameObject.transform.GetComponentInChildren <Camera> () == fog.fogCamera) { cameraInside = true; if (enableAlphaTransition) { fog.SetTargetAlpha(targetFogAlpha, targetSkyHazeAlpha, transitionDuration); } if (enableFogColorTransition) { fog.SetTargetColor(targetFogColor, transitionDuration); } if (enableFogSpecularColorTransition) { fog.SetTargetSpecularColor(targetFogSpecularColor, transitionDuration); } if (enableLightColorTransition) { fog.SetTargetLightColor(targetLightColor, transitionDuration); } } }
void OnTriggerEnter(Collider other) { if (cameraInside || targetFog == null) { return; } // Check if other collider has the main camera attached if (other == targetCollider || other.gameObject.transform.GetComponentInChildren <Camera>() == targetFog.fogCamera) { cameraInside = true; if (enableProfileTransition && targetProfile != null) { targetFog.SetTargetProfile(targetProfile, transitionDuration); } if (enableAlphaTransition) { targetFog.SetTargetAlpha(targetFogAlpha, targetSkyHazeAlpha, transitionDuration); } if (enableFogColorTransition) { targetFog.SetTargetColor(targetFogColor, transitionDuration); } if (enableFogSpecularColorTransition) { targetFog.SetTargetSpecularColor(targetFogSpecularColor, transitionDuration); } if (enableLightColorTransition) { targetFog.SetTargetLightColor(targetLightColor, transitionDuration); } if (debugMode) { Debug.Log("Fog Volume entered by " + other.name); } } }