/// <summary> /// 投影设置 /// </summary> void setProj() { if (!proj || !projCam) { return; } projCam.farClipPlane = proj.farClipPlane; projCam.nearClipPlane = proj.nearClipPlane; projCam.orthographic = proj.orthographic; //projCam.fieldOfView = proj.fieldOfView; projCam.orthographicSize = proj.orthographicSize; proj.ignoreLayers = projIgnoreLayers.value; ///阴影渲染设置 Shader shader = Shader.Find("Unlit/ShadowShow"); Material m = new Material(shader); m.SetTexture("_DepthTex", rt); m.SetTexture("_FadeTex", texFade); //m.SetFloat("", 1); //m.SetFloat("", 1); m.name = "projectorMat"; proj.GetComponent <Projector>().material = m; }
/// <summary> /// Creates an inner circle that decreases in radius based on how close an enemy is to the player. /// </summary> private void InnerCircle() { // check to see if the closest enemy is within the player's hit radius if (distanceToPlayerRadius < 0.01f) { // is is, condense the project to match innerProjector.GetComponent <Projector>().orthographicSize = distanceToPlayer; // calculate and set the alpha value for the gradient of the projector float gradientPrecentage = distanceToPlayer / outerLeftProjector.orthographicSize; innerProjector.GetComponent <Projector>().material.color = projectorColor.Evaluate(gradientPrecentage); } // it's not, keep project at outer project radius else { innerProjector.GetComponent <Projector>().orthographicSize = 0; } }
public void ApplyFallback(Projector projector) { if (m_fallbackShaderOrMaterial is Shader) { projector.material.shader = m_fallbackShaderOrMaterial as Shader; } else if (m_fallbackShaderOrMaterial is Material) { projector.material = m_fallbackShaderOrMaterial as Material; } ShadowTextureRenderer shadowRenderer = projector.GetComponent <ShadowTextureRenderer>(); shadowRenderer.blurLevel = m_blurLevel; shadowRenderer.blurSize = m_blurSize; shadowRenderer.mipLevel = 0; if (m_modifyTextureSize) { shadowRenderer.textureWidth = m_textureWidth; shadowRenderer.textureHeight = m_textureHeight; shadowRenderer.multiSampling = m_multiSampling; shadowRenderer.superSampling = m_superSampling; } }