private void CreateMaterials() { if (!this.m_SSAOMaterial && this.m_SSAOShader.isSupported) { this.m_SSAOMaterial = ScreenSpaceAmbientOcclusion.CreateMaterial(this.m_SSAOShader); this.m_SSAOMaterial.SetTexture("_RandomTexture", this.m_RandomTexture); } }
// 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; } } }
private void OnDisable() { ScreenSpaceAmbientOcclusion.DestroyMaterial(this.m_SSAOMaterial); }