using System;
using System.Collections;
using UnityEngine;

// Token: 0x020000FA RID: 250
public class LandingSpotController : MonoBehaviour
{
	// Token: 0x0600159F RID: 5535 RVA: 0x0019AFD0 File Offset: 0x001991D0
	public void Start()
	{
		if (this._transformCache == null)
		{
			this._transformCache = base.transform;
		}
		if (this._flock == null)
		{
			this._flock = (FlockController)Object.FindFirstObjectByType(typeof(FlockController));
			Debug.Log(((this != null) ? this.ToString() : null) + " has no assigned FlockController, a random FlockController has been assigned");
		}
		this._featherPS;
		if (this._landOnStart)
		{
			base.StartCoroutine(this.InstantLandOnStart(0.1f));
		}
	}

	// Token: 0x060015A0 RID: 5536 RVA: 0x0019B061 File Offset: 0x00199261
	public void ScareAll()
	{
		this.ScareAll(0f, 1f);
	}

	// Token: 0x060015A1 RID: 5537 RVA: 0x0019B074 File Offset: 0x00199274
	public void ScareAll(float minDelay, float maxDelay)
	{
		for (int i = 0; i < this._transformCache.childCount; i++)
		{
			if (this._transformCache.GetChild(i).GetComponent<LandingSpot>() != null)
			{
				this._transformCache.GetChild(i).GetComponent<LandingSpot>().ReleaseFlockChild();
			}
		}
	}

	// Token: 0x060015A2 RID: 5538 RVA: 0x0019B0C8 File Offset: 0x001992C8
	public void LandAll()
	{
		for (int i = 0; i < this._transformCache.childCount; i++)
		{
			if (this._transformCache.GetChild(i).GetComponent<LandingSpot>() != null)
			{
				LandingSpot component = this._transformCache.GetChild(i).GetComponent<LandingSpot>();
				base.StartCoroutine(component.GetFlockChild(0f, 2f));
			}
		}
	}

	// Token: 0x060015A3 RID: 5539 RVA: 0x0019B12D File Offset: 0x0019932D
	public IEnumerator InstantLandOnStart(float delay)
	{
		yield return new WaitForSeconds(delay);
		for (int i = 0; i < this._transformCache.childCount; i++)
		{
			if (this._transformCache.GetChild(i).GetComponent<LandingSpot>() != null)
			{
				this._transformCache.GetChild(i).GetComponent<LandingSpot>().InstantLand();
			}
		}
		yield break;
	}

	// Token: 0x060015A4 RID: 5540 RVA: 0x0019B143 File Offset: 0x00199343
	public IEnumerator InstantLand(float delay)
	{
		yield return new WaitForSeconds(delay);
		for (int i = 0; i < this._transformCache.childCount; i++)
		{
			if (this._transformCache.GetChild(i).GetComponent<LandingSpot>() != null)
			{
				this._transformCache.GetChild(i).GetComponent<LandingSpot>().InstantLand();
			}
		}
		yield break;
	}

	// Token: 0x040025B6 RID: 9654
	public bool _rotateAfterLanding = true;

	// Token: 0x040025B7 RID: 9655
	public bool _randomRotate = true;

	// Token: 0x040025B8 RID: 9656
	public Vector2 _autoCatchDelay = new Vector2(10f, 20f);

	// Token: 0x040025B9 RID: 9657
	public Vector2 _autoDismountDelay = new Vector2(10f, 20f);

	// Token: 0x040025BA RID: 9658
	public float _maxBirdDistance = 20f;

	// Token: 0x040025BB RID: 9659
	public float _minBirdDistance = 5f;

	// Token: 0x040025BC RID: 9660
	public bool _takeClosest;

	// Token: 0x040025BD RID: 9661
	public FlockController _flock;

	// Token: 0x040025BE RID: 9662
	public bool _landOnStart;

	// Token: 0x040025BF RID: 9663
	public bool _soarLand = true;

	// Token: 0x040025C0 RID: 9664
	public bool _onlyBirdsAbove;

	// Token: 0x040025C1 RID: 9665
	public float _landingSpeedModifier = 0.5f;

	// Token: 0x040025C2 RID: 9666
	public float _closeToSpotSpeedModifier = 1f;

	// Token: 0x040025C3 RID: 9667
	public float _releaseSpeedModifier = 3f;

	// Token: 0x040025C4 RID: 9668
	public float _landingTurnSpeedModifier = 5f;

	// Token: 0x040025C5 RID: 9669
	public Transform _featherPS;

	// Token: 0x040025C6 RID: 9670
	[HideInInspector]
	public ParticleSystem _featherParticles;

	// Token: 0x040025C7 RID: 9671
	[HideInInspector]
	public Transform _transformCache;

	// Token: 0x040025C8 RID: 9672
	[HideInInspector]
	public int _activeLandingSpots;

	// Token: 0x040025C9 RID: 9673
	[Range(0.01f, 1f)]
	public float _snapLandDistance = 0.05f;

	// Token: 0x040025CA RID: 9674
	public float _landedRotateSpeed = 2f;

	// Token: 0x040025CB RID: 9675
	public bool _drawGizmos = true;

	// Token: 0x040025CC RID: 9676
	public float _gizmoSize = 0.2f;

	// Token: 0x040025CD RID: 9677
	public bool _parentBirdToSpot;

	// Token: 0x040025CE RID: 9678
	public bool _abortLanding;

	// Token: 0x040025CF RID: 9679
	[Range(1f, 20f)]
	public float _abortLandingTimer = 10f;
}
