Files
BepInEx/Projects/BanquetForFools/Source/Assembly-CSharp/CollectCharacters.cs
2025-05-21 20:40:04 +02:00

141 lines
3.3 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
// Token: 0x0200001F RID: 31
public class CollectCharacters : MonoBehaviour
{
// Token: 0x06000485 RID: 1157 RVA: 0x000671DB File Offset: 0x000653DB
private void Start()
{
Links.x.characterCollector = this;
this.tr = base.transform;
base.gameObject.SetActive(false);
}
// Token: 0x06000486 RID: 1158 RVA: 0x00067200 File Offset: 0x00065400
public void SetSpherePosition(Vector3 pos)
{
this.tr.position = pos;
}
// Token: 0x06000487 RID: 1159 RVA: 0x00067210 File Offset: 0x00065410
private void OnTriggerEnter(Collider other)
{
GameObject gameObject = other.gameObject;
this.AddCharacter(gameObject);
}
// Token: 0x06000488 RID: 1160 RVA: 0x0006722B File Offset: 0x0006542B
public void AddCharacter(GameObject go)
{
if (this.charactersGo.IndexOf(go) == -1)
{
this.toAdd.Add(go);
this.changingCharacters = true;
}
}
// Token: 0x06000489 RID: 1161 RVA: 0x0006724F File Offset: 0x0006544F
public void SwitchBlock()
{
this.charactersGo.Clear();
this.characters.Clear();
}
// Token: 0x0600048A RID: 1162 RVA: 0x00067268 File Offset: 0x00065468
public void LateAddCharacter()
{
foreach (GameObject gameObject in this.toAdd)
{
if (gameObject)
{
this.charactersGo.Add(gameObject);
this.characters.Add(gameObject.GetComponent<Character>());
}
}
this.toAdd.Clear();
this.UpdateCharacterNumbers();
}
// Token: 0x0600048B RID: 1163 RVA: 0x000672EC File Offset: 0x000654EC
public void LateRemoveCharacter()
{
int count = this.characters.Count;
for (int i = 0; i < count; i++)
{
if (!this.characters[i])
{
this.toRemove.Add(null);
}
else if (this.characters[i].inactive)
{
this.toRemove.Add(this.charactersGo[i]);
}
}
foreach (GameObject gameObject in this.toRemove)
{
int num = this.charactersGo.IndexOf(gameObject);
if (num > -1)
{
this.charactersGo.RemoveAt(num);
if (this.characters[num])
{
this.characters[num].body.SetMask(false);
}
this.characters.RemoveAt(num);
}
}
this.toRemove.Clear();
this.UpdateCharacterNumbers();
}
// Token: 0x0600048C RID: 1164 RVA: 0x00067408 File Offset: 0x00065608
public void RemoveCharacter(GameObject go)
{
if (this.charactersGo.IndexOf(go) > -1)
{
this.toRemove.Add(go);
this.changingCharacters = true;
}
}
// Token: 0x0600048D RID: 1165 RVA: 0x0006742C File Offset: 0x0006562C
public void UpdateCharacterNumbers()
{
int count = this.characters.Count;
for (int i = 0; i < count; i++)
{
if (this.characters[i] && this.characters[i].body)
{
this.characters[i].body.SetMaskNumber(((float)i + 2f) * 1f);
}
}
}
// Token: 0x0600048E RID: 1166 RVA: 0x000674A0 File Offset: 0x000656A0
private void OnTriggerExit(Collider other)
{
GameObject gameObject = other.gameObject;
this.RemoveCharacter(gameObject);
}
// Token: 0x0400074F RID: 1871
public List<Character> characters = new List<Character>();
// Token: 0x04000750 RID: 1872
public List<GameObject> charactersGo = new List<GameObject>();
// Token: 0x04000751 RID: 1873
private List<GameObject> toRemove = new List<GameObject>();
// Token: 0x04000752 RID: 1874
private List<GameObject> toAdd = new List<GameObject>();
// Token: 0x04000753 RID: 1875
public Transform tr;
// Token: 0x04000754 RID: 1876
public bool changingCharacters;
}