private IEnumerator OnEnableRoutine() { yield return(null); if (base.Data != null) { ISuitcaseState suitcaseState = null; if (BoltNetwork.isRunning) { BoltEntity component = base.GetComponent <BoltEntity>(); if (component.isAttached && component.isOwner) { suitcaseState = component.GetState <ISuitcaseState>(); } } byte b = base.Data._instancesState[base.Index]; if (b != 0) { if (b == 1) { this._lid.Play(); this._interior.SetActive(true); this._trigger.SetActive(false); if (suitcaseState != null) { suitcaseState.Open = true; } goto IL_257; } if (b != 252) { this._lid.Play(); this._interior.SetActive(true); this._trigger.SetActive(false); int num = base.Data._instancesState[base.Index] >> 1; int num2 = 0; for (int i = 0; i < this._pickups.Length; i++) { bool flag = (num & 1 << i) == 0; if (this._pickups[i] && flag != this._pickups[i].activeSelf) { this._pickups[i].SetActive(flag); if (suitcaseState != null) { num2 |= 1 << this._pickups[i].transform.GetSiblingIndex(); } } } if (suitcaseState != null) { suitcaseState.Open = true; suitcaseState.FlaresPickedUp = num2; } goto IL_257; } } this._lid.transform.localRotation = this.LidDefaultRotation; this._interior.SetActive(false); this._trigger.SetActive(true); IL_257 :; } else { this._lid.transform.localRotation = this.LidDefaultRotation; this._interior.SetActive(false); this._trigger.SetActive(true); } yield break; }
private IEnumerator OnEnableRoutine() { yield return(null); if (base.Data != null) { ISuitcaseState suitcaseState = null; if (BoltNetwork.isRunning) { BoltEntity component = base.GetComponent <BoltEntity>(); if (component.isAttached) { suitcaseState = component.GetState <ISuitcaseState>(); } } byte b = base.Data._instancesState[base.Index]; switch (b) { case 0: break; case 1: this._lid.Play(); if (!this._interior.activeSelf) { this._interior.SetActive(true); } if (!this._pickup.activeSelf) { this._pickup.SetActive(true); } if (this._trigger.activeSelf) { this._trigger.SetActive(false); } if (suitcaseState != null) { suitcaseState.Open = true; suitcaseState.ClothPickedUp = false; } goto IL_293; case 2: this._lid.Play(); if (this._interior.activeSelf) { this._interior.SetActive(false); } if (this._trigger.activeSelf) { this._trigger.SetActive(false); } if (suitcaseState != null) { suitcaseState.Open = true; suitcaseState.ClothPickedUp = true; } goto IL_293; default: if (b != 252) { goto IL_293; } break; } base.Data._instancesState[base.Index] = 252; this._lid.transform.localRotation = this.LidDefaultRotation; if (this._interior.activeSelf) { this._interior.SetActive(false); } if (!this._pickup.activeSelf) { this._pickup.SetActive(true); } if (!this._trigger.activeSelf) { this._trigger.SetActive(true); } if (suitcaseState != null) { suitcaseState.Open = false; suitcaseState.ClothPickedUp = false; } IL_293 :; } else { this._lid.transform.localRotation = this.LidDefaultRotation; if (this._interior.activeSelf) { this._interior.SetActive(false); } if (!this._pickup.activeSelf) { this._pickup.SetActive(true); } if (!this._trigger.activeSelf) { this._trigger.SetActive(true); } } this._initializing = false; yield break; }
public override void OnEvent(DestroyPickUp evnt) { if (evnt.PickUpEntity) { if (evnt.PickUpEntity.isAttached) { if (evnt.PickUpEntity.isOwner) { if (evnt.PickUpEntity.StateIs <ISuitcaseState>()) { if (evnt.SibblingId >= 0) { ISuitcaseState state = evnt.PickUpEntity.GetState <ISuitcaseState>(); state.FlaresPickedUp |= 1 << evnt.SibblingId; } else { evnt.PickUpEntity.GetState <ISuitcaseState>().ClothPickedUp = true; } } else { if (evnt.FakeDrop) { if (evnt.PickUpPlayer == LocalPlayer.Entity) { LocalPlayer.Inventory.FakeDrop(evnt.ItemId); } else { PlayerAddItem playerAddItem = PlayerAddItem.Create(evnt.PickUpPlayer.source); playerAddItem.ItemId = evnt.ItemId; playerAddItem.Amount = 1; playerAddItem.Player = evnt.PickUpPlayer; playerAddItem.Send(); } } PickUp componentInChildren = evnt.PickUpEntity.GetComponentInChildren <PickUp>(); if (!componentInChildren || !componentInChildren.TryPool()) { BoltNetwork.Destroy(evnt.PickUpEntity); } } } else { DestroyPickUp destroyPickUp = DestroyPickUp.Raise(evnt.PickUpEntity.source); destroyPickUp.PickUpEntity = evnt.PickUpEntity; destroyPickUp.Send(); } } } else if (evnt.PickUpPlayer.isOwner) { ItemRemoveFromPlayer itemRemoveFromPlayer = ItemRemoveFromPlayer.Create(GlobalTargets.OnlySelf); itemRemoveFromPlayer.ItemId = itemRemoveFromPlayer.ItemId; itemRemoveFromPlayer.Send(); } else { ItemRemoveFromPlayer itemRemoveFromPlayer2 = ItemRemoveFromPlayer.Create(evnt.PickUpPlayer.source); itemRemoveFromPlayer2.ItemId = itemRemoveFromPlayer2.ItemId; itemRemoveFromPlayer2.Send(); } }