using System;
using System.Collections.Generic;
using UnityEngine;

// Token: 0x02000088 RID: 136
public class SceneCamera : MonoBehaviour
{
	// Token: 0x06000DC4 RID: 3524 RVA: 0x00104B3C File Offset: 0x00102D3C
	public void Setup()
	{
		for (int i = 0; i < this.boundingBoxes.Count; i++)
		{
			this.boundingBoxes[i].enabled = true;
			if (!this.boundingBoxes[i].gameObject.name.Contains("Camera"))
			{
				this.boundingBoxes[i].gameObject.layer = 30;
			}
		}
		this.sceneCamera.enabled = false;
		this.sceneCamera.gameObject.tag = "Untagged";
		foreach (InteriorLights interiorLights in this.pointLights)
		{
			interiorLights.LoadScene();
		}
	}

	// Token: 0x06000DC5 RID: 3525 RVA: 0x00104C10 File Offset: 0x00102E10
	public void SetupLayers()
	{
		for (int i = 0; i < this.boundingBoxes.Count; i++)
		{
			if (!this.boundingBoxes[i].gameObject.name.Contains("Camera"))
			{
				this.boundingBoxes[i].gameObject.layer = 30;
			}
		}
	}

	// Token: 0x06000DC6 RID: 3526 RVA: 0x00104C70 File Offset: 0x00102E70
	private void Awake()
	{
		if (this.backgroundArt)
		{
			this.backgroundArt.SetActive(true);
		}
		this.Off();
		for (int i = 0; i < this.quads.Count; i++)
		{
			this.quads[i].Setup(this);
		}
		foreach (object obj in base.transform)
		{
			Transform transform = (Transform)obj;
			if (transform.name.Contains("Mini"))
			{
				this.minimapCamera = transform.gameObject.GetComponent<Camera>();
			}
		}
		if (base.gameObject.name.Contains("Inspect") || base.gameObject.name.Contains("Frog") || base.gameObject.name.Contains("inspect") || base.gameObject.name.Contains("frog"))
		{
			this.cameraCollider.enabled = true;
			this.cameraCollider.gameObject.layer = 27;
			if (base.gameObject.name.Contains("frog"))
			{
				Object gameObject = base.gameObject;
				GameObject gameObject2 = base.gameObject;
				gameObject.name = (gameObject2.name += "Frog");
			}
			if (base.gameObject.name.Contains("inspect"))
			{
				Object gameObject3 = base.gameObject;
				GameObject gameObject4 = base.gameObject;
				gameObject3.name = (gameObject4.name += "Inspect");
			}
		}
		for (int j = 0; j < this.boundingBoxes.Count; j++)
		{
			this.boundingBoxes[j].enabled = true;
			this.boundingBoxes[j].gameObject.layer = 30;
		}
		for (int k = 0; k < this.interiorCameraBoxes.Count; k++)
		{
			this.interiorCameraBoxes[k].enabled = false;
			this.interiorCameraBoxes[k].gameObject.name = this.boundingBoxes[k].gameObject.name + "_camera";
		}
	}

	// Token: 0x06000DC7 RID: 3527 RVA: 0x00104ED8 File Offset: 0x001030D8
	private void Start()
	{
	}

	// Token: 0x06000DC8 RID: 3528 RVA: 0x00104EDC File Offset: 0x001030DC
	public void On()
	{
		Links.x.diorama.currCameraCollider = this.cameraCollider;
		if (this.fow)
		{
			this.fow.SetGlobalShaderVariables();
		}
		if (this.fowInterior)
		{
			this.fowInterior.SetGlobalShaderVariables();
		}
		Links.x.rtsCamera.GetCameraBounds();
		this.backgroundArt.SetActive(true);
		if (this.index >= 2)
		{
			for (int i = 0; i < this.quads.Count; i++)
			{
				this.quads[i].ChangeState(true, false);
			}
		}
	}

	// Token: 0x06000DC9 RID: 3529 RVA: 0x00104F7C File Offset: 0x0010317C
	public BoxCollider GetIndoorBounds(string interiorID)
	{
		BoxCollider boxCollider = this.cameraCollider;
		for (int i = 0; i < this.boundingBoxes.Count; i++)
		{
			if (this.boundingBoxes[i].gameObject.name == interiorID)
			{
				return this.boundingBoxes[i];
			}
		}
		return boxCollider;
	}

	// Token: 0x06000DCA RID: 3530 RVA: 0x00104FD4 File Offset: 0x001031D4
	public string GetInteriorBoundsName(Vector3 pt)
	{
		pt.y += 30f;
		RaycastHit raycastHit;
		if (Physics.Raycast(pt, Vector3.up * -1f, out raycastHit, 500f, 1073741824))
		{
			if (!(raycastHit.collider.gameObject.name == "Camera Collider") && !(raycastHit.collider.gameObject.name == "Exterior Camera Bounds"))
			{
				return raycastHit.collider.gameObject.name;
			}
			pt.y = raycastHit.point.y;
			pt.y -= 0.1f;
			RaycastHit raycastHit2;
			if (Physics.Raycast(pt, Vector3.up * -1f, out raycastHit2, 500f, 1073741824))
			{
				return raycastHit2.collider.gameObject.name;
			}
		}
		return "?";
	}

	// Token: 0x06000DCB RID: 3531 RVA: 0x001050C0 File Offset: 0x001032C0
	public BoxCollider GetInteriorCamera(string boundsName)
	{
		if (boundsName == null)
		{
			boundsName = "";
		}
		string text = boundsName + "_camera";
		for (int i = 0; i < this.interiorCameraBoxes.Count; i++)
		{
			if (this.interiorCameraBoxes[i].gameObject.name == text)
			{
				return this.interiorCameraBoxes[i];
			}
		}
		for (int j = 0; j < this.boundingBoxes.Count; j++)
		{
			if (this.boundingBoxes[j].gameObject.name == boundsName)
			{
				return this.boundingBoxes[j];
			}
		}
		return null;
	}

	// Token: 0x06000DCC RID: 3532 RVA: 0x00105168 File Offset: 0x00103368
	public InteriorLights GetPointLights(BoxCollider box)
	{
		if (this.pointLights.Count == this.interiorCameraBoxes.Count)
		{
			for (int i = 0; i < this.interiorCameraBoxes.Count; i++)
			{
				if (this.interiorCameraBoxes[i] == box)
				{
					return this.pointLights[i];
				}
			}
		}
		return null;
	}

	// Token: 0x06000DCD RID: 3533 RVA: 0x001051C8 File Offset: 0x001033C8
	public int GetPointLightCount(BoxCollider box)
	{
		if (this.pointLights.Count == this.interiorCameraBoxes.Count)
		{
			for (int i = 0; i < this.interiorCameraBoxes.Count; i++)
			{
				if (this.interiorCameraBoxes[i] == box)
				{
					return this.pointLights[i].lightCount;
				}
			}
		}
		return 0;
	}

	// Token: 0x06000DCE RID: 3534 RVA: 0x0010522A File Offset: 0x0010342A
	public void Off()
	{
		if (this.fow)
		{
			this.fow.isActive = false;
		}
		if (this.fowInterior)
		{
			this.fowInterior.isActive = false;
		}
	}

	// Token: 0x0400163B RID: 5691
	public int index;

	// Token: 0x0400163C RID: 5692
	public string id;

	// Token: 0x0400163D RID: 5693
	public bool perspectiveShot;

	// Token: 0x0400163E RID: 5694
	public bool isInterior;

	// Token: 0x0400163F RID: 5695
	public List<BoxCollider> boundingBoxes = new List<BoxCollider>();

	// Token: 0x04001640 RID: 5696
	public List<BoxCollider> interiorCameraBoxes = new List<BoxCollider>();

	// Token: 0x04001641 RID: 5697
	public Camera sceneCamera;

	// Token: 0x04001642 RID: 5698
	public Camera minimapCamera;

	// Token: 0x04001643 RID: 5699
	public BoxCollider cameraCollider;

	// Token: 0x04001644 RID: 5700
	public BoxCollider exteriorCameraBoundsCollider;

	// Token: 0x04001645 RID: 5701
	public FOWSystem fow;

	// Token: 0x04001646 RID: 5702
	public FOWSystemInterior fowInterior;

	// Token: 0x04001647 RID: 5703
	public GameObject terrainMap;

	// Token: 0x04001648 RID: 5704
	public List<InteriorLights> pointLights = new List<InteriorLights>();

	// Token: 0x04001649 RID: 5705
	[Header("Art")]
	public List<Culling> quads = new List<Culling>();

	// Token: 0x0400164A RID: 5706
	public GameObject backgroundArt;

	// Token: 0x0400164B RID: 5707
	public Texture2D sceneMap;
}
