Merge branch 'main' into art/enemies

This commit is contained in:
craftwill 2022-05-15 11:29:20 -04:00
commit 3843cad7e4
2 changed files with 3108 additions and 18395 deletions

File diff suppressed because it is too large Load Diff

View File

@ -108,10 +108,11 @@ public class WorldSwitcher : MonoBehaviour {
void ResetQuadPositions() { void ResetQuadPositions() {
Camera currCam = worldInfos[currentWorldIndex].camera; Camera currCam = worldInfos[currentWorldIndex].camera;
LayerMask currLayer = worldInfos[currentWorldIndex].layer;
for (int i = 0; i < worldInfos.Length; ++i) { for (int i = 0; i < worldInfos.Length; ++i) {
bool usingRenderTexture = i != currentWorldIndex; bool usingRenderTexture = i != currentWorldIndex;
worldInfos[i].SetUsingRenderTexture(usingRenderTexture); worldInfos[i].SetUsingRenderTexture(usingRenderTexture, currLayer);
if (usingRenderTexture) { if (usingRenderTexture) {
bool fromRight = i - currentWorldIndex > 0; bool fromRight = i - currentWorldIndex > 0;
@ -128,12 +129,14 @@ struct WorldInfo {
[HideInInspector] public RenderTexture texture; [HideInInspector] public RenderTexture texture;
public Transform renderQuad; public Transform renderQuad;
[HideInInspector] public Material material; [HideInInspector] public Material material;
public int layer;
static readonly int CameraTexture = Shader.PropertyToID("_CameraTexture"); static readonly int CameraTexture = Shader.PropertyToID("_CameraTexture");
public void SetUsingRenderTexture(bool usingTexture) { public void SetUsingRenderTexture(bool usingTexture, int layer) {
if (usingTexture) { if (usingTexture) {
camera.targetTexture = texture; camera.targetTexture = texture;
renderQuad.gameObject.SetActive(true); renderQuad.gameObject.SetActive(true);
renderQuad.gameObject.layer = layer;
}else { }else {
camera.targetTexture = null; camera.targetTexture = null;
renderQuad.gameObject.SetActive(false); renderQuad.gameObject.SetActive(false);
@ -145,8 +148,8 @@ struct WorldInfo {
if (usingTexture) if (usingTexture)
camera.targetTexture = null; camera.targetTexture = null;
//float height = 2f * Mathf.Atan(Mathf.Deg2Rad * camera.fieldOfView) * quadOffset; float height = 2f * Mathf.Atan(Mathf.Deg2Rad * camera.fieldOfView) * quadOffset;
renderQuad.localScale = new Vector3(camera.aspect, 1f, 1f); renderQuad.localScale = new Vector3(camera.aspect * height, height, 1f);
texture = new RenderTexture(Screen.width, Screen.height, 32); texture = new RenderTexture(Screen.width, Screen.height, 32);
material.SetTexture(CameraTexture, texture); material.SetTexture(CameraTexture, texture);