Exemplo n.º 1
0
    private void Awake()
    {
        DontDestroyOnLoad(this);
        m_Instance = this;
        m_Material = Resources.Load <Material>("Plane_No_zTest");
#if UNITY_EDITOR
        if (m_Material == null)
        {
            var resDir = new System.IO.DirectoryInfo(System.IO.Path.Combine(Application.dataPath, "Resources"));
            if (!resDir.Exists)
            {
                resDir.Create();
            }
            Shader s = Shader.Find("Plane/No zTest");
            if (s == null)
            {
                string shaderText = "Shader \"Plane/No zTest\" { SubShader { Pass { Blend SrcAlpha OneMinusSrcAlpha ZWrite Off Cull Off Fog { Mode Off } BindChannels { Bind \"Color\",color } } } }";
                string path       = System.IO.Path.Combine(resDir.FullName, "Plane_No_zTest.shader");
                Debug.Log("Shader missing, create asset: " + path);
                System.IO.File.WriteAllText(path, shaderText);
                UnityEditor.AssetDatabase.Refresh(UnityEditor.ImportAssetOptions.ForceSynchronousImport);
                UnityEditor.AssetDatabase.LoadAssetAtPath <Shader>("Resources/Plane_No_zTest.shader");
                s = Shader.Find("Plane/No zTest");
            }
            var mat = new Material(s);
            mat.name = "Plane_No_zTest";
            UnityEditor.AssetDatabase.CreateAsset(mat, "Assets/Resources/Plane_No_zTest.mat");
            m_Material = mat;
        }
#endif
    }
Exemplo n.º 2
0
 void loadLevel()
 {
     if (Application.loadedLevel != 3)
     {
         int nextlevel = Application.loadedLevel + 1;
         if (oculusPresent)
         {
             OVRCameraController.GetComponent <fadeInOut>().levelToLoad     = nextlevel;
             OVRCameraController.GetComponent <fadeInOut>().changeLevelFade = true;
         }
         else
         {
             Autofade.LoadLevel(nextlevel, 3, 3, Color.white);
         }
         FadeOutMusic();
     }
     if (Application.loadedLevel == 3)
     {
         int nextlevel = 0;
         if (oculusPresent)
         {
             OVRCameraController.GetComponent <fadeInOut>().levelToLoad     = nextlevel;
             OVRCameraController.GetComponent <fadeInOut>().changeLevelFade = true;
         }
         else
         {
             Autofade.LoadLevel(nextlevel, 3, 3, Color.white);
         }
         FadeOutMusic();
     }
 }
Exemplo n.º 3
0
 private void Awake()
 {
     DontDestroyOnLoad(this);
     m_Instance = this;
     m_Material = new Material("Shader \"Plane/No zTest\" { SubShader { Pass { Blend SrcAlpha OneMinusSrcAlpha ZWrite Off Cull Off Fog { Mode Off } BindChannels { Bind \"Color\",color } } } }");
 }
Exemplo n.º 4
0
	private void Awake()
	{
		DontDestroyOnLoad(this);
		m_Instance = this;
		m_Material = new Material("Shader \"Plane/No zTest\" { SubShader { Pass { Blend SrcAlpha OneMinusSrcAlpha ZWrite Off Cull Off Fog { Mode Off } BindChannels { Bind \"Color\",color } } } }");
	}