public static void SetScene(Vector2i Size) { if (Window.ENABLE_SHADOW) { depthMap = GL.GenTexture(); GL.BindTexture(TextureTarget.TextureCubeMap, depthMap); for (int i = 0; i < 6; ++i) { GL.TexImage2D(TextureTarget.TextureCubeMapPositiveX + i, 0, PixelInternalFormat.DepthComponent, Window.SHADOW_RESOLUTION, Window.SHADOW_RESOLUTION, 0, PixelFormat.DepthComponent, PixelType.Float, IntPtr.Zero); } GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureMinFilter, (float)TextureMinFilter.Nearest); GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureMagFilter, (float)TextureMagFilter.Nearest); GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureWrapS, (float)TextureWrapMode.ClampToEdge); GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureWrapT, (float)TextureWrapMode.ClampToEdge); GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureWrapR, (float)TextureWrapMode.ClampToEdge); depthMapFBO = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, depthMapFBO); GL.FramebufferTexture(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, depthMap, 0); GL.DrawBuffer(DrawBufferMode.None); GL.ReadBuffer(ReadBufferMode.None); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); } WindowSize = Size; Shader_Color = new Shader("../../../Shaders/shader.vert", "../../../Shaders/shader.frag"); Shader_Wireframe = new Shader("../../../Shaders/shader_line.vert", "../../../Shaders/shader_line.frag"); Shader_Depth = new Shader("../../../Shaders/shader_depth.vert", "../../../Shaders/shader_depth.frag", "../../../Shaders/shader_depth.geom"); LightProjectionMatrix = Matrix4.CreatePerspectiveFieldOfView(90f.Rad(), (float)WindowSize.X / (float)WindowSize.Y, 1f, LightFarPlane); LightSpaceMatrix.Add(Matrix4.LookAt(LightPosition, LightPosition + new Vector3(1, 0, 0), new Vector3(0, -1, 0)) * LightProjectionMatrix); LightSpaceMatrix.Add(Matrix4.LookAt(LightPosition, LightPosition + new Vector3(-1, 0, 0), new Vector3(0, -1, 0)) * LightProjectionMatrix); LightSpaceMatrix.Add(Matrix4.LookAt(LightPosition, LightPosition + new Vector3(0, 1, 0), new Vector3(0, 0, 1)) * LightProjectionMatrix); LightSpaceMatrix.Add(Matrix4.LookAt(LightPosition, LightPosition + new Vector3(0, -1, 0), new Vector3(0, 0, -1)) * LightProjectionMatrix); LightSpaceMatrix.Add(Matrix4.LookAt(LightPosition, LightPosition + new Vector3(0, 0, 1), new Vector3(0, -1, 0)) * LightProjectionMatrix); LightSpaceMatrix.Add(Matrix4.LookAt(LightPosition, LightPosition + new Vector3(0, 0, -1), new Vector3(0, -1, 0)) * LightProjectionMatrix); scene = new Object("scene"); Leonando.Objects(ref scene); Jeremy.Objects(ref scene); Nicholas.Objects(ref scene); scene.translateZ(-8.8f); scene.rotateZ(45f); scene.init(); lightSphere = new Object("lightsphere"); lightSphere.createBall(); lightSphere.scale(1); lightSphere.setTranslate(LightPosition.X, -LightPosition.Z, LightPosition.Y); lightSphere.setColor(255, 245, 166); lightSphere.init(); }
public void NicholasReleased(Nicholas nicholas) { targetableGoodGuys.Add(nicholas); if (OnNicholasReleased != null) { OnNicholasReleased.Invoke(nicholas); } }
public static void AnimateScene() { if (Window.PLAYANIMATION) { Leonando.Animations(ref scene); Jeremy.Animations(ref scene); Nicholas.Animations(ref scene); } }
public void OnTriggerEnter(Collider other) { Nicholas nicholas = other.GetComponent <Nicholas>(); if (nicholas != null) { GameManager.Instance.NicholasSaved(nicholas); Destroy(nicholas.gameObject); } }
public void NicholasSaved(Nicholas nicholas) { savedNicholases.Add(nicholas); saveableNicholases.Remove(nicholas); if (OnNicholasSaved != null) { OnNicholasSaved.Invoke(nicholas); } CheckIfAnyMoreNicholases(); }
private void OnTriggerExit(Collider other) { Nicholas nicholas = other.gameObject.GetComponent <Nicholas>(); if (nicholas != null) { if (selectedNicholas == nicholas) { selectedNicholas = null; } } }
public void NicholasDied(Nicholas nicholas) { targetableGoodGuys.Remove(nicholas); saveableNicholases.Remove(nicholas); diedNicholases.Add(nicholas); if (nicholasesTotal > 0) { nicholasesTotal--; } if (OnNicholasDied != null) { OnNicholasDied.Invoke(nicholas); } CheckIfAnyMoreNicholases(); }
private void Update() { bool isNicholasSelected = selectedNicholas != null; GameUI.Instance.ShowFollowInstructions(isNicholasSelected); if (isNicholasSelected) { if (Input.GetKeyDown(KeyCode.E)) { selectedNicholas.PleaseFollow(); if (OnNickolasRequestFollow != null) { OnNickolasRequestFollow.Invoke(); } selectedNicholas = null; } } }
private void OnTriggerEnter(Collider other) { Nicholas nicholas = other.gameObject.GetComponent <Nicholas>(); if (nicholas != null) { switch (nicholas.CurrentState) { case Nicholas.State.Released: case Nicholas.State.Wandering: var heading = nicholas.transform.position - transform.position; float dot = Vector3.Dot(heading, transform.forward); if (dot > 0f) { selectedNicholas = nicholas; } break; } } }
private void Start() { selectedNicholas = null; }