using System;
using UnityEngine;

// Token: 0x0200000C RID: 12
public class FOWRevealerInterior : MonoBehaviour
{
	// Token: 0x06000095 RID: 149 RVA: 0x0000CE30 File Offset: 0x0000B030
	protected virtual void Start()
	{
		this.mTrans = base.transform;
		if (this.once)
		{
			this.lineOfSightCheck = FOWSystemInterior.LOSChecks.OnlyOnce;
			this.isActive = true;
		}
		this.mRevealer = FOWSystemInterior.CreateRevealer();
	}

	// Token: 0x06000096 RID: 150 RVA: 0x0000CE5F File Offset: 0x0000B05F
	protected virtual void OnDisable()
	{
		if (this.mRevealer != null)
		{
			this.mRevealer.isActive = false;
		}
	}

	// Token: 0x06000097 RID: 151 RVA: 0x0000CE75 File Offset: 0x0000B075
	protected virtual void OnDestroy()
	{
		if (this.mRevealer != null)
		{
			FOWSystemInterior.DeleteRevealer(this.mRevealer);
			this.mRevealer = null;
		}
	}

	// Token: 0x06000098 RID: 152 RVA: 0x0000CE94 File Offset: 0x0000B094
	protected virtual void LateUpdate()
	{
		if (this.isActive)
		{
			if (this.lineOfSightCheck != FOWSystemInterior.LOSChecks.OnlyOnce)
			{
				this.mRevealer.isValid = false;
			}
			if (this.main || Records.x.mainMenuOpen)
			{
				if (!this.character)
				{
					this.character = base.gameObject.GetComponent<Character>();
				}
				if (this.character.mainSelected)
				{
					this.character.UpdateCC();
					if (this.character.stats.SightRadiusBase() < 0.5f)
					{
						this.range = new Vector2(0.1f, 50f);
					}
					else
					{
						this.range = new Vector2(0.1f, this.character.stats.SightRadius(false, false, true));
					}
				}
				else
				{
					this.range = new Vector2(1f, 4f);
				}
			}
			this.mRevealer.pos = this.mTrans.position + new Vector3(0f, 3f, 0f);
			this.mRevealer.inner = this.range.x;
			this.mRevealer.outer = this.range.y;
			this.mRevealer.los = this.lineOfSightCheck;
			this.mRevealer.isActive = true;
			return;
		}
		if (this.mRevealer.isActive)
		{
			this.mRevealer.isActive = false;
			this.mRevealer.isValid = false;
		}
	}

	// Token: 0x06000099 RID: 153 RVA: 0x0000D014 File Offset: 0x0000B214
	public void Rebuild()
	{
		this.mRevealer.isValid = false;
	}

	// Token: 0x040001F4 RID: 500
	private Transform mTrans;

	// Token: 0x040001F5 RID: 501
	public Vector2 range;

	// Token: 0x040001F6 RID: 502
	public Character character;

	// Token: 0x040001F7 RID: 503
	private string currentTimeOfDay;

	// Token: 0x040001F8 RID: 504
	public bool main;

	// Token: 0x040001F9 RID: 505
	public bool once;

	// Token: 0x040001FA RID: 506
	public FOWSystemInterior.LOSChecks lineOfSightCheck = FOWSystemInterior.LOSChecks.EveryUpdate;

	// Token: 0x040001FB RID: 507
	public bool isActive = true;

	// Token: 0x040001FC RID: 508
	protected FOWSystemInterior.Revealer mRevealer;
}
