Пример #1
0
    // Use this for initialization
    void Start()
    {
        bInited    = false;
        MainCamera = transform.Find("WorldCamera").GetComponent <Camera>();
        ppBehavior = MainCamera.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>();
        offset     = transform.position - CameraPivot.transform.position;
        if (TargetBody == null)
        {
            TargetBody = GameObject.FindGameObjectWithTag("Player");
            Debug.Log("未绑定目标物体,默认替换为Player标签的物体");
        }
        if (CameraPivot)
        {
            transform.LookAt(CameraPivot.transform);
        }
        else
        {
            Debug.LogError("未绑定相机焦点物体");
        }

        for (int i = 0, length = IgnoreLayers.Length; i < length; ++i)
        {
            layerMask |= 1 << LayerMask.NameToLayer(IgnoreLayers[i]);
        }
        layerMask = ~layerMask;

        GameClient.Instance.NextTick(() => bInited = true, 0.1f);
    }
Пример #2
0
 private void Awake()
 {
     renderersHidden      = new List <Renderer>();
     m_PostProcBehavior   = GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>();
     m_DefaultDOFSettings = m_PostProcBehavior.profile.depthOfField.settings;
     m_DefaultFOV         = Cam.fieldOfView;
 }
Пример #3
0
    void OnEnable()
    {
        ppb         = GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour> ();
        profile     = Instantiate(ppb.profile);
        ppb.profile = profile;

        ppb.profile.ambientOcclusion.enabled = QualitySettings.GetQualityLevel() > 3;
        ppb.profile.bloom.enabled            = QualitySettings.GetQualityLevel() > 2;
    }
Пример #4
0
 void Start()
 {
     PostProcessingBehaviour = Camera.main.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>();
     ScreenWidth             = Screen.width;
     ScreenHeight            = Screen.height;
     Dropdown.onValueChanged.AddListener(delegate
     {
         myDropdownValueChangedHandler(Dropdown);
     });
 }
Пример #5
0
    private void Awake()
    {
        if (GameManager.Instance == null) //so we don't have to test directly out of "Main" every time
        {
            PersistentModel.GameSceneOverride = SceneManager.GetActiveScene().name;
            SceneManager.LoadScene("Main", LoadSceneMode.Single);
            return;
        }

        #if UNITY_WEBGL
        UnityEngine.PostProcessing.PostProcessingBehaviour postProcessingBehavior = Camera.main.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>();
        if (Application.platform == RuntimePlatform.WebGLPlayer && IsSafari())
        {
            var profile = postProcessingBehavior.profile;
            profile.colorGrading.enabled = false;
        }
        #endif

        Time = PersistentModel.Instance.ChallengeTime;

        SceneManager.sceneLoaded += OnSceneLoaded;

        laps = PersistentModel.Instance.GameLaps;

        if (!PersistentModel.Instance.DEBUG)
        {
            GameObject.Find("Debug").SetActive(false);
        }

        SetWeather(WEATHER_DEFAULT);

        GameScreen = UIManager.Instance.GetComponentInChildren <GameScreen>();

        //////////////////////////////////////////////////////////////////////////////////////////
        // init race time event manager
        //////////////////////////////////////////////////////////////////////////////////////////
        raceTimeEventManager = new RaceTimeEventManager();
        raceTimeEventManager.Initialize(this);

        // its null if user has not selected a tire option
        if (PersistentModel.Instance.TireOptionSelectedData != null)
        {
            if (PersistentModel.Instance.TireOptionSelectedData.correct)
            {
                PersistentModel.Instance.TireOptionSelectedData = null;
            }
            else
            {
                // stop race and show alert
                raceTimeEventManager.AddTimeEvent(RaceTimeEventManager.Event.FORCE_STOP, 1f);
            }
        }
        //////////////////////////////////////////////////////////////////////////////////////////
    }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        dl                     = GameObject.FindGameObjectWithTag("DrawListener").GetComponent <DrawListener>();
        cam                    = Camera.main;
        camController          = cam.gameObject.GetComponent <CameraController>();
        nextCheckForDeathPaths = checkForDeadPaths;
        riders.AddRange(GameObject.FindGameObjectsWithTag("Player"));
        postProc     = cam.gameObject.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>();
        deathProfile = (UnityEngine.PostProcessing.PostProcessingProfile)Instantiate(Resources.Load("Profiles/DeathProfile"));

        // Determine camera bounds
        upperXBound = cam.gameObject.transform.position.x + (cam.orthographicSize * Screen.width / Screen.height);
        lowerXBound = cam.gameObject.transform.position.x - (cam.orthographicSize * Screen.width / Screen.height);
        upperYBound = cam.gameObject.transform.position.y + cam.orthographicSize;
        lowerYBound = cam.gameObject.transform.position.y - cam.orthographicSize;
    }
    void Start()
    {
        if (Application.platform == RuntimePlatform.Android)
        {
            UnityEngine.PostProcessing.PostProcessingBehaviour _p = GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour> ();
            if (_p != null)
            {
                _p.enabled = false;
            }
            enabled = false;
        }

        trans = transform;
        trans.LookAt(target);

        angleY = trans.eulerAngles.y;
        angleX = trans.eulerAngles.x;
        bMove  = true;
    }
Пример #8
0
 // Use this for initialization.
 void Start()
 {
     // Cache the camera's post processing behaviour into the one created above.
     postProcBehaviour = postProcCamera.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>();
 }
Пример #9
0
        void Update()
        {
            if (RootScript.RootScriptInstance.paused)
            {
                if (postProcess.profile.colorGrading.enabled || QualitySettings.pixelLightCount < optimalPixelLightAmount)
                {
                    PreparePostProcess();
                }
            }


            if (currentLevel == 1)
            {
                if (MFPClassicAssets.root.allEnemies.Length != 0)
                {
                    if (MFPClassicAssets.player.kPunchPublic)
                    {
                        if (MFPClassicAssets.root.allEnemies[0].GetComponent <EnemyScript>().enabled)
                        {
                            recentAttackType   = "kick";
                            tutorialEnemyAlive = true;
                            Invoke("CheckTutorialStatus", 0.1f);
                        }
                    }

                    if (playerInput.GetButtonDown("Fire"))
                    {
                        MFPClassicAssets.root.clearInstructionText();
                    }
                }
            }

#if DEBUG
            if (Input.GetKeyDown(KeyCode.P))
            {
                UnityEngine.PostProcessing.PostProcessingBehaviour behaviour = GameObject.Find("Main Camera").GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>();

                if (behaviour.profile.colorGrading.enabled)
                {
                    behaviour.profile.colorGrading.enabled = false;
                }
                else
                {
                    behaviour.profile.colorGrading.enabled = true;
                }
            }

            if (Input.GetKeyDown(KeyCode.O))
            {
                foreach (Light l in GameObject.Find("MFPLevel").GetComponentsInChildren <Light>())
                {
                    l.range -= 10;
                }
            }

            if (Input.GetKeyDown(KeyCode.I))
            {
                GameObject.FindObjectOfType <LevelChangerScript>().doTheThing();
            }
#endif
        }