using System; using System.Collections.Generic; using UnityEngine; // Token: 0x020000B8 RID: 184 public class ItemCollector : MonoBehaviour { // Token: 0x0600119E RID: 4510 RVA: 0x001595AC File Offset: 0x001577AC private void Start() { this.UpdateSize(); Links.x.inventory.groundBag.itemCollectorSize = this.size; } // Token: 0x0600119F RID: 4511 RVA: 0x001595CE File Offset: 0x001577CE public void UpdateSize() { if (Links.x.mk) { this.size = 20f; } else { this.size = 20f; } Links.x.inventory.groundBag.itemCollectorSize = this.size; } // Token: 0x060011A0 RID: 4512 RVA: 0x0015960E File Offset: 0x0015780E public bool HasItem(Item i) { return this.hitItems.Contains(i); } // Token: 0x060011A1 RID: 4513 RVA: 0x00159624 File Offset: 0x00157824 public bool CheckInteractiveLineOfSight(Item item) { if (Links.x.hasMain) { Vector3 position = Links.x.main.tr.position; return !Physics.Linecast(Links.x.main.raycastPosition, item.gameObject.transform.position, 2163200); } return false; } // Token: 0x060011A2 RID: 4514 RVA: 0x00159684 File Offset: 0x00157884 private void Enter(GameObject other) { GameObject gameObject = other.gameObject; if (gameObject) { Item component = gameObject.GetComponent(); if (component) { if (!component.destroying && component.active && component.gameObject.activeSelf) { if (this.screenSize) { Links.x.inventory.groundBag.HitScreenItem(component, true); component.InRange(); } else { Links.x.inventory.groundBag.HitItem(component, true); } if (this.screenSize) { Links.x.inventory.groundBag.SetCollectorUpdateFromTrigger(); return; } } } else { BreakableActions component2 = gameObject.gameObject.transform.parent.gameObject.GetComponent(); if (component2 && component2.resourceLocation > -1) { component2.InRange(); } } } } // Token: 0x060011A3 RID: 4515 RVA: 0x00159764 File Offset: 0x00157964 private void Exit(GameObject other) { GameObject gameObject = other.gameObject; if (gameObject) { Item component = gameObject.GetComponent(); if (component) { if (this.screenSize) { Links.x.inventory.groundBag.RemovePopItem(component); Links.x.inventory.groundBag.HitScreenItem(component, false); component.OutOfRange(); } else { Links.x.inventory.groundBag.HitItem(component, false); } if (this.screenSize) { Links.x.inventory.groundBag.SetCollectorUpdateFromTrigger(); return; } } else { BreakableActions component2 = gameObject.gameObject.transform.parent.gameObject.GetComponent(); if (component2 && component2.resourceLocation > -1) { component2.OutOfRange(); } } } } // Token: 0x060011A4 RID: 4516 RVA: 0x00159834 File Offset: 0x00157A34 public void EmptyItems() { int count = this.hitItems.Count; for (int i = 0; i < count; i++) { if (this.newItems.IndexOf(this.hitItems[i]) == -1) { if (this.hitItems[i]) { this.Exit(this.hitItems[i].gameObject); } this.hitItems[i] = null; } } this.hitItems.Clear(); } // Token: 0x060011A5 RID: 4517 RVA: 0x001598B5 File Offset: 0x00157AB5 public void LoadScene() { this.party = Links.x.portraitOrder; this.groundItems = Links.x.diorama.groundItems; } // Token: 0x060011A6 RID: 4518 RVA: 0x001598DC File Offset: 0x00157ADC public void UpdateLists() { this.Update(); } // Token: 0x060011A7 RID: 4519 RVA: 0x001598E4 File Offset: 0x00157AE4 private void Update() { if (Links.x) { int bombID = Links.x.library.bombID; if (Links.x.gaia.sceneLoaded && !Records.x.removeControls && Links.x.main) { if (this.party == null) { this.party = Links.x.portraitOrder; } if (this.groundItems == null) { this.groundItems = Links.x.diorama.groundItems; } int count = this.groundItems.Count; int count2 = this.party.Count; this.newItems.Clear(); for (int i = 0; i < count; i++) { Item item2 = this.groundItems[i]; if (item2 && item2.active && !item2.destroying && !item2.instantiating && item2.clickable) { if (item2.gameObject.activeInHierarchy && item2.gameObject.activeSelf && this.PartyClose(Links.x.main, item2.tr.position, this.size) && this.CheckInteractiveLineOfSight(item2) && item2.invRow._UIModel != "None" && item2.invRow._UIModel != "NoneOnly") { this.newItems.Add(item2); } if (item2.ID == bombID && item2.durability.x > 0f && Links.x.gameplay.seconds > item2.durability.x + 126f) { item2.BombBomb(item2.tr.position); return; } } } bool flag = false; int num = this.hitItems.Count; for (int j = 0; j < num; j++) { if (this.newItems.IndexOf(this.hitItems[j]) == -1) { if (this.hitItems[j]) { this.Exit(this.hitItems[j].gameObject); } this.hitItems[j] = null; flag = true; } } if (flag) { this.hitItems.RemoveAll((Item item) => item == null); } num = this.newItems.Count; for (int k = 0; k < num; k++) { if (this.hitItems.IndexOf(this.newItems[k]) == -1 && this.newItems[k]) { this.Enter(this.newItems[k].gameObject); this.hitItems.Add(this.newItems[k]); } } } } } // Token: 0x060011A8 RID: 4520 RVA: 0x00159BFC File Offset: 0x00157DFC public bool PartyClose(Character character, Vector3 point, float dist) { point.y = character.tr.position.y; return (character.tr.position - point).sqrMagnitude < dist * dist; } // Token: 0x04001D1B RID: 7451 public bool screenSize; // Token: 0x04001D1C RID: 7452 private List party; // Token: 0x04001D1D RID: 7453 private List groundItems; // Token: 0x04001D1E RID: 7454 public List hitItems = new List(); // Token: 0x04001D1F RID: 7455 public List newItems = new List(); // Token: 0x04001D20 RID: 7456 public float size; }