コード例 #1
0
    public static void DepthScEnable(bool enable)
    {
//        if (null == m_Controller || null == m_Controller.m_TargetCam)
//        {
//            return;
//        }

        DepthOfField34 depthSc = Camera.main.GetComponent <DepthOfField34>();

        if (null != depthSc)
        {
            depthSc.enabled = enable;
        }
    }
コード例 #2
0
        private void Awake()
        {
            timeToEndGame = 0f;
            int whichLayer = UnityEngine.Random.Range(0, 3);

            if (whichLayer == 0)
            {
                Picture1.SetActive(true);
            }
            if (whichLayer == 1)
            {
                Picture2.SetActive(true);
            }
            if (whichLayer == 2)
            {
                Picture3.SetActive(true);
            }

            foregroundGameobject   = GameObject.Find("Foreground");
            middlegroundGameobject = GameObject.Find("Middleground");
            backgroundGameobject   = GameObject.Find("Background");
            targetPlane            = GameObject.FindGameObjectWithTag("Player");

            cameraHUDOverlay = GameObject.Find("Camera HUD");

            generalCam = GameObject.Find("DOFCamera").GetComponent <UnityStandardAssets.ImageEffects.DepthOfField>();
            focusPoint = GameObject.Find("FocusPoint");

            cameraAudioSource      = focusPoint.GetComponent <AudioSource>();
            cameraAudioSource.clip = cameraFocus;
            cameraAudioSource.loop = true;

            basePosition1 = foregroundGameobject.transform.position;
            basePosition2 = middlegroundGameobject.transform.position;
            basePosition3 = backgroundGameobject.transform.position;

            startPosition = basePosition1;
            endPosition   = basePosition2;
            moveToTarget  = whereToMove.moveToBack;

            foreToMidDistance = middlegroundGameobject.transform.position.z + foregroundGameobject.transform.position.z;
            midToBackDistance = backgroundGameobject.transform.position.z - middlegroundGameobject.transform.position.z;
            test = cameraAudioSource.pitch;
            cameraAudioSource.Play();
        }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        //アニメータコンポーネントを取得
        this.myAnimator = GetComponent <Animator>();
        //走るアニメーションを開始
        this.myAnimator.SetFloat("Speed", 1);
        //Rigidbodyコンポーネントを取得(追加)
        this.myRigidbody = GetComponent <Rigidbody>();
        //シーン中のstateTextオブジェクトを取得(追加)
        this.stateText = GameObject.Find("GameResultText");
        //シーン中のscoreTextオブジェクトを取得(追加)
        this.scoreText = GameObject.Find("ScoreText");

        // モバイルの時はカメラエフェクトを切る
        UnityStandardAssets.ImageEffects.ScreenSpaceAmbientOcclusion ssao = Camera.main.GetComponent <UnityStandardAssets.ImageEffects.ScreenSpaceAmbientOcclusion>();
        UnityStandardAssets.ImageEffects.DepthOfField dof = Camera.main.GetComponent <UnityStandardAssets.ImageEffects.DepthOfField>();
        if (ssao)
        {
            if (Application.platform == RuntimePlatform.Android ||
                Application.platform == RuntimePlatform.IPhonePlayer)
            {
                ssao.enabled = false;
            }
            else
            {
                ssao.enabled = true;
            }
        }
        if (dof)
        {
            if (Application.platform == RuntimePlatform.Android ||
                Application.platform == RuntimePlatform.IPhonePlayer)
            {
                dof.enabled = false;
            }
            else
            {
                dof.enabled = true;
            }
        }
    }
コード例 #4
0
 public void Awake()
 {
     instance = this;
 }
コード例 #5
0
 protected override void OnEnable()
 {
     base.OnEnable();
     FX_DOF = GetComponent<DepthOfField>();
     Speed = MinSpeed;
 }
コード例 #6
0
 // add this after CheckResources check as a transpiler
 static void Prefix(UnityStandardAssets.ImageEffects.DepthOfField __instance)
 {
     __instance.highResolution = true;
 }
コード例 #7
0
    public void InitPostProcessingEffects() {

        cameraMotionBlur = this.GetComponentInChildren<UnityStandardAssets.ImageEffects.CameraMotionBlur>();
        depthOfField = this.GetComponentInChildren<UnityStandardAssets.ImageEffects.DepthOfField>();
        cameraMotionBlur.enabled = false;
        depthOfField.enabled = false;
        //Enable CameraMotionBlur if Setting is allowed to be on
        if (PlayerPrefs.GetInt("CMB") == 1)
        {
            CMBEnabled = true;
        }
        else
        {
            CMBEnabled = false;
            cameraMotionBlur.enabled = false;
        }

        if (PlayerPrefs.GetInt("DOF") == 1)
        {
            DOFEnabled = true;
        }
        else
        {
            DOFEnabled = false;
            depthOfField.enabled = false;
        }
    }