using System;
using UnityEngine;

// Token: 0x020000F1 RID: 241
public class UnluckDistanceDisabler : MonoBehaviour
{
	// Token: 0x06001551 RID: 5457 RVA: 0x00198440 File Offset: 0x00196640
	public void Start()
	{
		if (this._distanceFromMainCam)
		{
			this._distanceFrom = Camera.main.transform;
		}
		base.InvokeRepeating("CheckDisable", this._disableCheckInterval + Random.value * this._disableCheckInterval, this._disableCheckInterval);
		base.InvokeRepeating("CheckEnable", this._enableCheckInterval + Random.value * this._enableCheckInterval, this._enableCheckInterval);
		base.Invoke("DisableOnStart", 0.01f);
	}

	// Token: 0x06001552 RID: 5458 RVA: 0x001984BD File Offset: 0x001966BD
	public void DisableOnStart()
	{
		if (this._disableOnStart)
		{
			base.gameObject.SetActive(false);
		}
	}

	// Token: 0x06001553 RID: 5459 RVA: 0x001984D4 File Offset: 0x001966D4
	public void CheckDisable()
	{
		if (base.gameObject.activeInHierarchy && (base.transform.position - this._distanceFrom.position).sqrMagnitude > (float)(this._distanceDisable * this._distanceDisable))
		{
			base.gameObject.SetActive(false);
		}
	}

	// Token: 0x06001554 RID: 5460 RVA: 0x00198530 File Offset: 0x00196730
	public void CheckEnable()
	{
		if (!base.gameObject.activeInHierarchy && (base.transform.position - this._distanceFrom.position).sqrMagnitude < (float)(this._distanceDisable * this._distanceDisable))
		{
			base.gameObject.SetActive(true);
		}
	}

	// Token: 0x0400252D RID: 9517
	public int _distanceDisable = 1000;

	// Token: 0x0400252E RID: 9518
	public Transform _distanceFrom;

	// Token: 0x0400252F RID: 9519
	public bool _distanceFromMainCam;

	// Token: 0x04002530 RID: 9520
	public float _disableCheckInterval = 10f;

	// Token: 0x04002531 RID: 9521
	public float _enableCheckInterval = 1f;

	// Token: 0x04002532 RID: 9522
	public bool _disableOnStart;
}
