| 123456789101112131415161718192021 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- /* 开关-是否给相机添加雾霾特效 */
- public class FogCameraToggle : MonoBehaviour
- {
- static bool isOn = true;
- DayToNight dayToNight;
- Toggle toggle;
- void Start()
- {
- dayToNight = this.transform.GetComponentInParent<DayToNight>();
- toggle = this.transform.GetComponent<Toggle>();
- toggle.onValueChanged.AddListener(delegate(bool value) {
- isOn = value;
- dayToNight.SetFogCamera(isOn);
- });
- toggle.isOn = isOn;
- }
- }
|