public override void FireEvent()
 {
     if (this.m_LinkerCamera != null)
     {
         string     path       = "plot_c/plotcam_depth_of_field";
         GameObject gameObject = Resources.Load(path) as GameObject;
         if (gameObject != null)
         {
             Camera     component   = this.m_LinkerCamera.GetComponent <Camera>();
             GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject);
             gameObject2.transform.SetParent(this.m_LinkerCamera.transform, false);
             Camera component2 = gameObject2.GetComponent <Camera>();
             component2.fieldOfView = component.fieldOfView;
             DepthOfField34 component3 = gameObject2.GetComponent <DepthOfField34>();
             component3.quality          = this.quality;
             component3.resolution       = this.resolution;
             component3.simpleTweakMode  = this.simpleTweakMode;
             component3.focalPoint       = this.focalPoint;
             component3.smoothness       = this.smoothness;
             component3.focalZDistance   = this.focalZDistance;
             component3.focalZStartCurve = this.focalZStartCurve;
             component3.focalZEndCurve   = this.focalZEndCurve;
             component3.objectFocus      = this.objectFocus;
             component3.focalSize        = this.focalSize;
             component3.bluriness        = this.bluriness;
             component3.maxBlurSpread    = this.maxBlurSpread;
             if (component != null)
             {
                 component.enabled = false;
             }
         }
     }
 }
 // Use this for initialization
 void Start()
 {
     if (!networkView.isMine)
     {
         enabled = false;
         return;
     }
     mb = Camera.main.GetComponent <MotionBlur>();
     df = Camera.main.GetComponent <DepthOfField34>();
 }
    // ***************************
    // add private variable here
    // ***************************
    void Start()
    {
        _ohCam = GetComponent<RtsCamera>();
        if (_ohCam == null)
            this.enabled = false;

        _dof3 = GetComponent<DepthOfField34>();
        _dof4 = GetComponent<DepthOfFieldScatter>();
        // ***************************
        // get instance of component here
        // ***************************
    }
 void OnSetState(TankControlState ts)
 {
     tankControlState = ts;
     if (tankControlState == TankControlState.AutoDrive)
     {
         GetComponent <TankSpecialCameraController>().enabled = false;
         GetComponent <TankCanonBehaviour>().enabled          = false;
         foreach (UserInfoClass a in GlobalInfo.userInfoList)
         {
             if (a.playerViewID.Equals(networkView.viewID))
             {
                 nam = a.name;
             }
         }
     }
     else
     {
         aimCross                = (Texture)Resources.Load("GUI/GunSights/TankGunSight");
         v_AimCross              = (Texture)Resources.Load("GUI/GunSights/W_1");
         h_AimCross              = (Texture)Resources.Load("GUI/GunSights/W_2");
         aimCrossPos             = new Vector2(Screen.width / 2.0f, Screen.height / 2.0f);
         camPos                  = Camera.main.transform;
         GlobalInfo.playerCamera = Camera.main;
         sm          = camPos.GetComponent <SmoothFollow>();
         sm.enabled  = true;
         sm.target   = transform;
         sm.distance = camDistance;
         sm.height   = camHeight;
         df          = camPos.GetComponent <DepthOfField34>();
         df.enabled  = false;
         urc         = camPos.GetComponent <UltraRedRayCamera>();
         urc.enabled = false;
         Camera.main.SendMessage("OnSetWather", SendMessageOptions.DontRequireReceiver);
         gf = camPos.GetComponent <GlobalFog>();
         GameObject go = GameObject.Find("Snow");
         if (go != null)
         {
             for (int i = 0; i < 4; i++)
             {
                 camPos.GetChild(i).particleEmitter.emit = true;
             }
         }
         go = GameObject.Find("Rain");
         if (go != null)
         {
             for (int i = 0; i < 4; i++)
             {
                 camPos.GetChild(i).particleEmitter.emit = true;
             }
         }
     }
 }
示例#5
0
    // ***************************
    // add private variable here
    // ***************************

    void Start()
    {
        _ohCam = GetComponent <RtsCamera>();
        if (_ohCam == null)
        {
            this.enabled = false;
        }

        _dof3 = GetComponent <DepthOfField34>();
        _dof4 = GetComponent <DepthOfFieldScatter>();
        // ***************************
        // get instance of component here
        // ***************************
    }
	public void Start()
	{
		if (SceneManager.GetActiveScene().name != "SchoolScene")
		{
			this.DoNothing = true;
		}
		if (!this.DoNothing)
		{
			DepthOfField34[] components = Camera.main.GetComponents<DepthOfField34>();
			this.ExperimentalDepthOfField34 = components[1];
			this.ToggleExperiment();
			if (OptionGlobals.ParticleCount == 0)
			{
				OptionGlobals.ParticleCount = 3;
			}
			if (OptionGlobals.DrawDistance == 0)
			{
				OptionGlobals.DrawDistanceLimit = 350;
				OptionGlobals.DrawDistance = 350;
			}
			if (OptionGlobals.DisableFarAnimations == 0)
			{
				OptionGlobals.DisableFarAnimations = 10;
			}
			if (OptionGlobals.Sensitivity == 0)
			{
				OptionGlobals.Sensitivity = 3;
			}
			this.ToggleRun();
			this.UpdateFog();
			this.UpdateAnims();
			this.UpdateBloom();
			this.UpdateShadows();
			this.UpdateFPSIndex();
			this.UpdateParticles();
			this.UpdateObscurance();
			this.UpdatePostAliasing();
			this.UpdateDrawDistance();
			this.UpdateLowDetailStudents();
			this.Settings.ToggleBackground();
			if (!OptionGlobals.DepthOfField)
			{
				this.ToggleExperiment();
			}
		}
	}
示例#7
0
    public void SetDOf(int state)
    {
        DepthOfField34 dof = Camera.mainCamera.GetComponent <DepthOfField34>();

        if (dof != null)
        {
            if (state == 0)
            {
                dof.enabled = false;
            }
            if (state == 1)
            {
                dof.enabled = true;
            }
        }
        else
        {
            print("No DOF");
        }
    }
    void Refresh()
    {
        parser.Clear();
        if (parser.DoesExist(IniFiles.CONFIG))
        {
            parser.Load(IniFiles.CONFIG);
        }
        else
        {
            gs.Create();
            parser.Load(IniFiles.CONFIG);
        }

        DepthOfField34          dof      = gameObject.GetComponent <DepthOfField34>();
        Bloom                   blf      = gameObject.GetComponent <Bloom>();
        AmbientObscurance       ssao     = gameObject.GetComponent <AmbientObscurance>();
        SunShafts               sunshaft = gameObject.GetComponent <SunShafts>();
        NoiseAndGrain           nag      = gameObject.GetComponent <NoiseAndGrain>();
        EdgeDetectEffectNormals edn      = gameObject.GetComponent <EdgeDetectEffectNormals>();
        Vignetting              vig      = gameObject.GetComponent <Vignetting>();

        if (bool.Parse(parser.Get("fx_enable")))
        {
            if (bool.Parse(parser.Get("fx_dof")))
            {
                dof.enabled    = true;
                dof.resolution = DofResolution.High;
                dof.quality    = bool.Parse(parser.Get("fx_dof_foreground")) ? Dof34QualitySetting.BackgroundAndForeground : Dof34QualitySetting.OnlyBackground;
                dof.bokeh      = bool.Parse(parser.Get("fx_dof_bokeh")) ? true : false;

                dof.focalPoint = float.Parse(parser.Get("fx_dof_focaldistance"));
                dof.smoothness = float.Parse(parser.Get("fx_dof_smoothness"));
                dof.focalSize  = float.Parse(parser.Get("fx_dof_focalSize"));

                dof.visualize = bool.Parse(parser.Get("fx_dof_visualizeFocus"));

                switch (parser.Get("fx_dof_blurriness"))
                {
                case "0":
                    dof.bluriness = DofBlurriness.Low;
                    break;

                case "1":
                    dof.bluriness = DofBlurriness.High;
                    break;

                case "2":
                    dof.bluriness = DofBlurriness.VeryHigh;
                    break;

                default:
                    dof.bluriness = DofBlurriness.High;
                    break;
                }

                dof.maxBlurSpread         = float.Parse(parser.Get("fx_dof_blurSpread"));
                dof.foregroundBlurExtrude = float.Parse(parser.Get("fx_dof_foregroundSize"));

                switch (parser.Get("fx_dof_bokeh_destination"))
                {
                case "0":
                    dof.bokehDestination = BokehDestination.Background;
                    break;

                case "1":
                    dof.bokehDestination = BokehDestination.BackgroundAndForeground;
                    break;

                case "2":
                    dof.bokehDestination = BokehDestination.Foreground;
                    break;

                default:
                    dof.bokehDestination = BokehDestination.Background;
                    break;
                }

                dof.bokehIntensity           = float.Parse(parser.Get("fx_dof_bokeh_intensity"));
                dof.bokehThreshholdLuminance = float.Parse(parser.Get("fx_dof_bokeh_minLuminance"));
                dof.bokehThreshholdContrast  = float.Parse(parser.Get("fx_dof_bokeh_minContrast"));
                dof.bokehDownsample          = int.Parse(parser.Get("fx_dof_bokeh_DownSample"));
                dof.bokehScale = float.Parse(parser.Get("fx_dof_bokeh_sizeScale"));
            }
            else
            {
                dof.enabled = false;
            }

            // SSAO

            if (bool.Parse(parser.Get("fx_SSAO")))
            {
                ssao.enabled            = true;
                ssao.intensity          = float.Parse(parser.Get("fx_SSAO_intensity"));
                ssao.radius             = float.Parse(parser.Get("fx_SSAO_radius"));
                ssao.blurIterations     = int.Parse(parser.Get("fx_SSAO_blurIterations"));
                ssao.blurFilterDistance = float.Parse(parser.Get("fx_SSAO_blurFilterDistance"));
                ssao.downsample         = int.Parse(parser.Get("fx_SSAO_downsample"));
            }
            else
            {
                ssao.enabled = false;
            }

            // NOISE GRAIN

            nag.enabled             = bool.Parse(parser.Get("fx_noisegrain")) ? true : false;
            nag.intensityMultiplier = float.Parse(parser.Get("fx_noisegrain_intensity"));

            // BLOOM

            if (bool.Parse(parser.Get("fx_bloom")))
            {
                blf.enabled = true;

                switch (parser.Get("fx_bloom_quality"))
                {
                case "0":
                    blf.quality = Bloom.BloomQuality.Cheap;
                    break;

                case "1":
                    blf.quality = Bloom.BloomQuality.High;
                    break;

                default:
                    blf.quality = Bloom.BloomQuality.High;
                    break;
                }

                switch (parser.Get("fx_bloom_mode"))
                {
                case "0":
                    blf.tweakMode = Bloom.TweakMode.Basic;
                    break;

                case "1":
                    blf.tweakMode = Bloom.TweakMode.Complex;
                    break;

                default:
                    blf.tweakMode = Bloom.TweakMode.Complex;
                    break;
                }

                switch (parser.Get("fx_bloom_blendMode"))
                {
                case "0":
                    blf.screenBlendMode = Bloom.BloomScreenBlendMode.Screen;
                    break;

                case "1":
                    blf.screenBlendMode = Bloom.BloomScreenBlendMode.Add;
                    break;

                default:
                    blf.screenBlendMode = Bloom.BloomScreenBlendMode.Add;
                    break;
                }

                blf.hdr                 = bool.Parse(parser.Get("fx_bloom_hdr")) ? Bloom.HDRBloomMode.On : Bloom.HDRBloomMode.Off;
                blf.bloomIntensity      = float.Parse(parser.Get("fx_bloom_intensity"));
                blf.bloomThreshhold     = float.Parse(parser.Get("fx_bloom_threshhold"));
                blf.bloomBlurIterations = int.Parse(parser.Get("fx_bloom_blurIterations"));
                blf.blurWidth           = float.Parse(parser.Get("fx_bloom_sampleDistance"));

                switch (parser.Get("fx_bloom_lensFlareMode"))
                {
                case "0":
                    blf.lensflareMode = Bloom.LensFlareStyle.Ghosting;
                    break;

                case "1":
                    blf.lensflareMode = Bloom.LensFlareStyle.Anamorphic;
                    break;

                case "2":
                    blf.lensflareMode = Bloom.LensFlareStyle.Combined;
                    break;

                default:
                    blf.lensflareMode = Bloom.LensFlareStyle.Ghosting;
                    break;
                }

                blf.lensflareIntensity  = float.Parse(parser.Get("fx_bloom_LFlocalIntensity"));
                blf.lensflareThreshhold = float.Parse(parser.Get("fx_bloom_LFthreshhold"));
            }
            else
            {
                blf.enabled = false;
            }

            // Sunshafts

            if (bool.Parse(parser.Get("fx_sunshaft")))
            {
                sunshaft.enabled         = true;
                sunshaft.useDepthTexture = bool.Parse(parser.Get("fx_sunshaft_zBuffer"));

                switch (parser.Get("fx_sunshaft_resolution"))
                {
                case "0":
                    sunshaft.resolution = SunShaftsResolution.Low;
                    break;

                case "1":
                    sunshaft.resolution = SunShaftsResolution.Normal;
                    break;

                case "2":
                    sunshaft.resolution = SunShaftsResolution.High;
                    break;

                default:
                    sunshaft.resolution = SunShaftsResolution.Normal;
                    break;
                }

                switch (parser.Get("fx_sunshaft_blendMode"))
                {
                case "0":
                    sunshaft.screenBlendMode = ShaftsScreenBlendMode.Add;
                    break;

                case "1":
                    sunshaft.screenBlendMode = ShaftsScreenBlendMode.Screen;
                    break;

                default:
                    sunshaft.screenBlendMode = ShaftsScreenBlendMode.Screen;
                    break;
                }

                sunshaft.maxRadius            = float.Parse(parser.Get("fx_sunshaft_distFalloff"));
                sunshaft.sunShaftBlurRadius   = float.Parse(parser.Get("fx_sunshaft_blurSize"));
                sunshaft.radialBlurIterations = int.Parse(parser.Get("fx_sunshaft_blurIterations"));
                sunshaft.sunShaftIntensity    = float.Parse(parser.Get("fx_sunshaft_intensity"));
                sunshaft.useSkyBoxAlpha       = float.Parse(parser.Get("fx_sunshaft_alphaMask"));
            }
            else
            {
                sunshaft.enabled = false;
            }

            // Edge detect

            edn.enabled = bool.Parse(parser.Get("fx_edgeDetect")) ? true : false;

            // Vignetting

            if (bool.Parse(parser.Get("fx_vignetting")))
            {
                vig.enabled             = true;
                vig.intensity           = float.Parse(parser.Get("fx_vignetting_intensity"));
                vig.blurSpread          = float.Parse(parser.Get("fx_vignetting_blurredCornors"));
                vig.chromaticAberration = float.Parse(parser.Get("fx_vignetting_aberration"));
            }
            else
            {
                vig.enabled = false;
            }
        }
        else
        {
            dof.enabled      = false;
            ssao.enabled     = false;
            nag.enabled      = false;
            blf.enabled      = false;
            sunshaft.enabled = false;
            edn.enabled      = false;
            vig.enabled      = false;
        }
    }
示例#9
0
 public void Awake()
 {
     DepthOfField = GetComponent <DepthOfField34>();
     mask         = ~(LayerMask.NameToLayer("Player") & LayerMask.NameToLayer("Equipped Items"));
 }
示例#10
0
 void Start()
 {
     depthOfField = GetComponent<DepthOfField34>();
 }
示例#11
0
 void Awake()
 {
     dofScript = GetComponent <DepthOfField34>();
 }
示例#12
0
 /// <summary>
 /// Init all needed objects
 /// </summary>
 void Start()
 {
     doFFocusTarget = new GameObject ("DoFFocusTarget");
     dofComponent = gameObject.GetComponent<DepthOfField34> ();
     dofComponent.objectFocus = doFFocusTarget.transform;
 }
示例#13
0
 void Start()
 {
     DoF = gameObject.GetComponent <DepthOfField34>();
     Refresh();
 }