// Update is called once per frame void Update() { if (fadingIn == true) { UB.D2FogsPE fogPE = Camera_With_Fog.GetComponent <UB.D2FogsPE>(); secondsPassed -= Time.deltaTime; float percent = 1 / Ghost.Seconds_To_Fade; fogPE.Color = new Color(secondsPassed * percent, secondsPassed * percent, secondsPassed * percent, 0.5f); if (secondsPassed <= 0.0f) { fogPE.Color = new Color(0.0f, 0.0f, 0.0f, 0.5f); fadingIn = false; secondsPassed = 0.0f; } } if (fadingOut == true) { UB.D2FogsPE fogPE = Camera_With_Fog.GetComponent <UB.D2FogsPE>(); secondsPassed += Time.deltaTime; float percent = 1 / Ghost.Seconds_To_Fade; fogPE.Color = new Color(secondsPassed * percent, secondsPassed * percent, secondsPassed * percent, 0.5f); if (secondsPassed >= Ghost.Seconds_To_Fade) { fogPE.Color = new Color(1.0f, 1.0f, 1.0f, 0.5f); fadingOut = false; secondsPassed = Ghost.Seconds_To_Fade; } } }
// Update is called once per frame void Start() { //for the fog arCamera = GameObject.FindGameObjectWithTag("MainCamera"); d2FogsPE = arCamera.GetComponent <UB.D2FogsPE>(); GameObject gameControllerObject = GameObject.FindGameObjectWithTag("GameController"); if (gameControllerObject != null) { gameController = gameControllerObject.GetComponent <Done_GameController>(); } if (gameController == null) { Debug.Log("Cannot find 'GameController' script"); } }
// Use this for initialization void Awake() { fog = GetComponent <UB.D2FogsPE>(); FFMessage <FogMsg> .Connect(IncrementFogDensity); }