Add source files
This commit is contained in:
104
Projects/BanquetForFools/Source/Assembly-CSharp/FlockScare.cs
Normal file
104
Projects/BanquetForFools/Source/Assembly-CSharp/FlockScare.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
// Token: 0x020000F7 RID: 247
|
||||
public class FlockScare : MonoBehaviour
|
||||
{
|
||||
// Token: 0x0600158D RID: 5517 RVA: 0x0019A6A0 File Offset: 0x001988A0
|
||||
private void CheckProximityToLandingSpots()
|
||||
{
|
||||
this.IterateLandingSpots();
|
||||
if (this.currentController._activeLandingSpots > 0 && this.CheckDistanceToLandingSpot(this.landingSpotControllers[this.lsc]))
|
||||
{
|
||||
this.landingSpotControllers[this.lsc].ScareAll();
|
||||
}
|
||||
base.Invoke("CheckProximityToLandingSpots", this.scareInterval);
|
||||
}
|
||||
|
||||
// Token: 0x0600158E RID: 5518 RVA: 0x0019A6FC File Offset: 0x001988FC
|
||||
private void IterateLandingSpots()
|
||||
{
|
||||
this.ls += this.checkEveryNthLandingSpot;
|
||||
this.currentController = this.landingSpotControllers[this.lsc];
|
||||
int childCount = this.currentController.transform.childCount;
|
||||
if (this.ls > childCount - 1)
|
||||
{
|
||||
this.ls -= childCount;
|
||||
if (this.lsc < this.landingSpotControllers.Length - 1)
|
||||
{
|
||||
this.lsc++;
|
||||
return;
|
||||
}
|
||||
this.lsc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600158F RID: 5519 RVA: 0x0019A784 File Offset: 0x00198984
|
||||
private bool CheckDistanceToLandingSpot(LandingSpotController lc)
|
||||
{
|
||||
Transform child = lc.transform.GetChild(this.ls);
|
||||
LandingSpot component = child.GetComponent<LandingSpot>();
|
||||
if (component._landingChild != null && (child.position - base.transform.position).sqrMagnitude < this.distanceToScare * this.distanceToScare)
|
||||
{
|
||||
if (this.scareAll)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
component.ReleaseFlockChild();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06001590 RID: 5520 RVA: 0x0019A7F8 File Offset: 0x001989F8
|
||||
private void Invoker()
|
||||
{
|
||||
for (int i = 0; i < this.InvokeAmounts; i++)
|
||||
{
|
||||
float num = this.scareInterval / (float)this.InvokeAmounts * (float)i;
|
||||
base.Invoke("CheckProximityToLandingSpots", this.scareInterval + num);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001591 RID: 5521 RVA: 0x0019A83B File Offset: 0x00198A3B
|
||||
private void OnEnable()
|
||||
{
|
||||
base.CancelInvoke("CheckProximityToLandingSpots");
|
||||
if (this.landingSpotControllers.Length != 0)
|
||||
{
|
||||
this.Invoker();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001592 RID: 5522 RVA: 0x0019A857 File Offset: 0x00198A57
|
||||
private void OnDisable()
|
||||
{
|
||||
base.CancelInvoke("CheckProximityToLandingSpots");
|
||||
}
|
||||
|
||||
// Token: 0x040025A3 RID: 9635
|
||||
public LandingSpotController[] landingSpotControllers;
|
||||
|
||||
// Token: 0x040025A4 RID: 9636
|
||||
public float scareInterval = 0.1f;
|
||||
|
||||
// Token: 0x040025A5 RID: 9637
|
||||
public float distanceToScare = 2f;
|
||||
|
||||
// Token: 0x040025A6 RID: 9638
|
||||
public int checkEveryNthLandingSpot = 1;
|
||||
|
||||
// Token: 0x040025A7 RID: 9639
|
||||
public int InvokeAmounts = 1;
|
||||
|
||||
// Token: 0x040025A8 RID: 9640
|
||||
private int lsc;
|
||||
|
||||
// Token: 0x040025A9 RID: 9641
|
||||
private int ls;
|
||||
|
||||
// Token: 0x040025AA RID: 9642
|
||||
private LandingSpotController currentController;
|
||||
|
||||
// Token: 0x040025AB RID: 9643
|
||||
public bool scareAll = true;
|
||||
}
|
||||
Reference in New Issue
Block a user