void Awake() { nightVis = GetComponent <NightVisionEffect>(); UnityEngine.XR.InputTracking.Recenter(); //ourDrone = GameObject.FindGameObjectWithTag("Player").gameObject; Input.gyro.enabled = true; }
public void OnEnable() { rendererCamera = Camera.main; isSupported = true; m_CommandBuffers = new Dictionary <Type, KeyValuePair <CameraEvent, CommandBuffer> >(); renderTextureFactory = new RenderTextureFactory(); m_Camera = gameObject.GetComponent <Camera>(); PostEffectModelContainer postEffectModel = Resources.Load("PostEffectModelContainer") as PostEffectModelContainer; blurEffect = new BlurEffect(); blurEffect.renderTextureFactory = renderTextureFactory; blurEffectModel = postEffectModel.blurEffectModel; blurEffect.SetPostEffectModel <BlurEffectModel>(blurEffectModel); oldFilmEffect = new OldFilmEffect(); oldFilmEffect.renderTextureFactory = renderTextureFactory; oldFilmEffectModel = postEffectModel.oldFilmEffectModel; oldFilmEffect.SetPostEffectModel <OldFilmEffectModel>(oldFilmEffectModel); nightVisionEffect = new NightVisionEffect(); nightVisionEffect.renderTextureFactory = renderTextureFactory; nightVisionEffectModel = postEffectModel.nightVisionEffectModel; nightVisionEffect.SetPostEffectModel <NightVisionEffectModel>(nightVisionEffectModel); ambientOcclusionEffect = new AmbientOcclusionEffect(); ambientOcclusionEffect.renderTextureFactory = renderTextureFactory; ambientOcclusionModel = postEffectModel.ambientOcclusionModel; ambientOcclusionEffect.SetPostEffectModel(ambientOcclusionModel); postEffectList.Add(blurEffect); postEffectList.Add(oldFilmEffect); postEffectList.Add(nightVisionEffect); postEffectList.Add(ambientOcclusionEffect); for (int i = 0; i < postEffectList.Count; i++) { BasePostEffect postEffect = postEffectList[i]; postEffect.OnEnable(); } CheckResources(); }