public override void Initialize() { this.Enabled = false; testRS = Core.Scene.CreateRenderSurfaceEx(-1, -1, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_A8R8G8B8, true, true, 1); testRSID = testRS.GetIndex(); testFS = Core.Scene.CreateShader(); bool result = testFS.CreateFromEffectFile(Path.Combine(Application.StartupPath, @"Data\Shaders\Grayscale.fx")); }
// Use this for initialization void Start() { var rt = new RenderTexture(Screen.width, Screen.height, 24); Shader.SetGlobalTexture("_TimeCrackTexture", rt); hiddenCamera.targetTexture = rt; tvShader = activeCamera.GetComponent <TVShader>(); ChangeCamera(); //worldState = WorldLayers.WORLD_0; //worldIdx = 0; }
public void ChangeCamera() { contrast = tvShader.contrast; brightness = tvShader.brightness; StartCoroutine(TeleportEffectStart(0.5f)); activeCamera.targetTexture = hiddenCamera.targetTexture; hiddenCamera.targetTexture = null; var swapCam = hiddenCamera; worldIdx++; switch (worldIdx) { case 0: worldState = WorldLayers.WORLD_0; player.layer = 9; portal.layer = 9; break; case 1: worldState = WorldLayers.WORLD_1; player.layer = 10; portal.layer = 10; hiddenCamera = cameras[2]; break; case 2: worldState = WorldLayers.WORLD_2; player.layer = 11; portal.layer = 11; hiddenCamera = cameras[0]; break; default: worldState = WorldLayers.WORLD_0; worldIdx = 0; player.layer = 9; portal.layer = 9; hiddenCamera = cameras[1]; break; } var rt = new RenderTexture(Screen.width, Screen.height, 24); hiddenCamera.targetTexture = rt; Shader.SetGlobalTexture("_TimeCrackTexture", rt); //hiddenCamera = activeCamera; activeCamera = swapCam; tvShader = activeCamera.GetComponent <TVShader>(); StartCoroutine(TeleportEffectEnd(0.5f)); }