Files
UltimateFishing/Assets/Scripts/Assembly-UnityScript/LandingSpotController.cs
2026-02-21 16:45:37 +08:00

243 lines
5.8 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using Boo.Lang;
using UnityEngine;
[Serializable]
public class LandingSpotController : MonoBehaviour
{
[Serializable]
internal sealed class _0024InstantLandOnStart_0024823 : GenericGenerator<WaitForSeconds>
{
[Serializable]
internal sealed class _0024 : GenericGeneratorEnumerator<WaitForSeconds>, IEnumerator
{
internal int _0024i_0024824;
internal LandingSpot _0024spot_0024825;
internal float _0024delay_0024826;
internal LandingSpotController _0024self__0024827;
public _0024(float delay, LandingSpotController self_)
{
_0024delay_0024826 = delay;
_0024self__0024827 = self_;
}
public override bool MoveNext()
{
int result;
switch (_state)
{
default:
result = (Yield(2, new WaitForSeconds(_0024delay_0024826)) ? 1 : 0);
break;
case 2:
for (_0024i_0024824 = 0; _0024i_0024824 < _0024self__0024827._thisT.childCount; _0024i_0024824++)
{
if ((bool)(LandingSpot)_0024self__0024827._thisT.GetChild(_0024i_0024824).GetComponent(typeof(LandingSpot)))
{
_0024spot_0024825 = (LandingSpot)_0024self__0024827._thisT.GetChild(_0024i_0024824).GetComponent(typeof(LandingSpot));
_0024spot_0024825.InstantLand();
}
}
YieldDefault(1);
goto case 1;
case 1:
result = 0;
break;
}
return (byte)result != 0;
}
}
internal float _0024delay_0024828;
internal LandingSpotController _0024self__0024829;
public _0024InstantLandOnStart_0024823(float delay, LandingSpotController self_)
{
_0024delay_0024828 = delay;
_0024self__0024829 = self_;
}
public override IEnumerator<WaitForSeconds> GetEnumerator()
{
return new _0024(_0024delay_0024828, _0024self__0024829);
}
}
[Serializable]
internal sealed class _0024InstantLand_0024830 : GenericGenerator<WaitForSeconds>
{
[Serializable]
internal sealed class _0024 : GenericGeneratorEnumerator<WaitForSeconds>, IEnumerator
{
internal int _0024i_0024831;
internal LandingSpot _0024spot_0024832;
internal float _0024delay_0024833;
internal LandingSpotController _0024self__0024834;
public _0024(float delay, LandingSpotController self_)
{
_0024delay_0024833 = delay;
_0024self__0024834 = self_;
}
public override bool MoveNext()
{
int result;
switch (_state)
{
default:
result = (Yield(2, new WaitForSeconds(_0024delay_0024833)) ? 1 : 0);
break;
case 2:
for (_0024i_0024831 = 0; _0024i_0024831 < _0024self__0024834._thisT.childCount; _0024i_0024831++)
{
if ((bool)(LandingSpot)_0024self__0024834._thisT.GetChild(_0024i_0024831).GetComponent(typeof(LandingSpot)))
{
_0024spot_0024832 = (LandingSpot)_0024self__0024834._thisT.GetChild(_0024i_0024831).GetComponent(typeof(LandingSpot));
_0024spot_0024832.InstantLand();
}
}
YieldDefault(1);
goto case 1;
case 1:
result = 0;
break;
}
return (byte)result != 0;
}
}
internal float _0024delay_0024835;
internal LandingSpotController _0024self__0024836;
public _0024InstantLand_0024830(float delay, LandingSpotController self_)
{
_0024delay_0024835 = delay;
_0024self__0024836 = self_;
}
public override IEnumerator<WaitForSeconds> GetEnumerator()
{
return new _0024(_0024delay_0024835, _0024self__0024836);
}
}
public bool _randomRotate;
public Vector2 _autoCatchDelay;
public Vector2 _autoDismountDelay;
public float _maxBirdDistance;
public float _minBirdDistance;
public bool _takeClosest;
public FlockController _flock;
public bool _landOnStart;
public bool _soarLand;
public bool _onlyBirdsAbove;
public float _landingSpeedModifier;
public float _landingTurnSpeedModifier;
public Transform _featherPS;
public Transform _thisT;
public LandingSpotController()
{
_randomRotate = true;
_autoCatchDelay = new Vector2(10f, 20f);
_autoDismountDelay = new Vector2(10f, 20f);
_maxBirdDistance = 20f;
_minBirdDistance = 5f;
_soarLand = true;
_landingSpeedModifier = 0.5f;
_landingTurnSpeedModifier = 5f;
}
public virtual void Start()
{
if (!_thisT)
{
_thisT = transform;
}
if (!_flock)
{
_flock = (FlockController)UnityEngine.Object.FindObjectOfType(typeof(FlockController));
Debug.Log(this + " has no assigned FlockController, a random FlockController has been assigned");
}
if (_landOnStart)
{
StartCoroutine(InstantLandOnStart(0.1f));
}
}
public virtual void ScareAll()
{
for (int i = 0; i < _thisT.childCount; i++)
{
if ((bool)(LandingSpot)_thisT.GetChild(i).GetComponent(typeof(LandingSpot)))
{
LandingSpot landingSpot = (LandingSpot)_thisT.GetChild(i).GetComponent(typeof(LandingSpot));
StartCoroutine(landingSpot.ReleaseFlockChild(0f, 1f));
}
}
}
public virtual void ScareAll(float minDelay, float maxDelay)
{
for (int i = 0; i < _thisT.childCount; i++)
{
if ((bool)(LandingSpot)_thisT.GetChild(i).GetComponent(typeof(LandingSpot)))
{
LandingSpot landingSpot = (LandingSpot)_thisT.GetChild(i).GetComponent(typeof(LandingSpot));
StartCoroutine(landingSpot.ReleaseFlockChild(minDelay, maxDelay));
}
}
}
public virtual void LandAll()
{
for (int i = 0; i < _thisT.childCount; i++)
{
if ((bool)(LandingSpot)_thisT.GetChild(i).GetComponent(typeof(LandingSpot)))
{
LandingSpot landingSpot = (LandingSpot)_thisT.GetChild(i).GetComponent(typeof(LandingSpot));
StartCoroutine(landingSpot.GetFlockChild(0f, 2f));
}
}
}
public virtual IEnumerator InstantLandOnStart(float delay)
{
return new _0024InstantLandOnStart_0024823(delay, this).GetEnumerator();
}
public virtual IEnumerator InstantLand(float delay)
{
return new _0024InstantLand_0024830(delay, this).GetEnumerator();
}
public virtual void Main()
{
}
}