private void SetTargetItem() { if (!this._heldItemGo && base.state.TargetPlayer != null && base.state.ItemId > 0) { CoopPlayerRemoteSetup component = base.state.TargetPlayer.GetComponent <CoopPlayerRemoteSetup>(); foreach (GameObject gameObject in component.rightHand.Available) { HeldItemIdentifier component2 = gameObject.GetComponent <HeldItemIdentifier>(); if (component2 && component2._itemId == base.state.ItemId) { this._heldItemGo = gameObject; CoopWeaponUpgrades component3 = gameObject.GetComponent <CoopWeaponUpgrades>(); this._mirror = component3._mirror; this._cloth = component3._cloth; this._painting = component3._painting; this._altRenderers = component3._altRenderers; if (base.state.Token != null) { this.RefreshUpgradeViews(); } base.state.RemoveCallback("ItemId", new PropertyCallbackSimple(this.SetTargetItem)); base.state.RemoveCallback("TargetPlayer", new PropertyCallbackSimple(this.SetTargetItem)); break; } } } }
public void ActivateIfIsStealableItem(GameObject held) { HeldItemIdentifier component = held.GetComponent <HeldItemIdentifier>(); if (component) { int itemId = component._itemId; this._heldStorage = null; if (itemId == this._metalTinTrayItemId) { this._nextSteal = Time.realtimeSinceStartup + 0.5f; base.gameObject.SetActive(true); this._heldStorage = held.GetComponent <ItemStorage>(); return; } for (int i = 0; i < this._stealableItems.Length; i++) { if (this._stealableItems[i] == itemId) { this._nextSteal = Time.realtimeSinceStartup + 0.5f; base.gameObject.SetActive(true); return; } } this._sheenIcon.SetActive(false); this._pickupIcon.SetActive(false); base.gameObject.SetActive(false); base.enabled = false; } }
public override void Attached() { if (this.entity.isOwner) { HeldItemIdentifier componentInParent = base.GetComponentInParent <HeldItemIdentifier>(); base.state.Position = componentInParent.transform.position - base.transform.position; base.state.Rotation = Quaternion.Inverse(componentInParent.transform.rotation) * base.transform.rotation; base.state.Entity = LocalPlayer.Entity; } else { base.state.AddCallback("Entity", new PropertyCallbackSimple(this.SetParent)); base.state.AddCallback("Position", new PropertyCallbackSimple(this.SetPosition)); base.state.AddCallback("Rotation", new PropertyCallbackSimple(this.SetRotation)); this.SetParent(); } }
public override void Attached() { if (base.entity && base.entity.isAttached) { if (base.entity.isOwner) { HeldItemIdentifier componentInParent = base.GetComponentInParent <HeldItemIdentifier>(); base.state.Position = ((!this.attachToCloth) ? (componentInParent.transform.position - base.transform.position) : base.transform.parent.localPosition); base.state.Rotation = Quaternion.Inverse(componentInParent.transform.rotation) * base.transform.rotation; base.state.TargetPlayer = LocalPlayer.Entity; } else { base.state.AddCallback("TargetPlayer", new PropertyCallbackSimple(this.SetParent)); base.state.AddCallback("Position", new PropertyCallbackSimple(this.SetPosition)); base.state.AddCallback("Rotation", new PropertyCallbackSimple(this.SetRotation)); this.SetParent(); } } }
private bool enableAdvancedWeapon(int index) { if (index == -1) { index = UnityEngine.Random.Range(0, 3); } this.advancedWeapons[index].SetActive(true); HeldItemIdentifier component = this.advancedWeapons[index].GetComponent <HeldItemIdentifier>(); if (component) { if (CoopPeerStarter.DedicatedHost) { return(true); } if (LocalPlayer.Inventory.Owns(component._itemId, true)) { this.hasAdvancedWeapon = true; return(true); } } this.advancedWeapons[index].SetActive(false); return(false); }
private bool enableRegularWeapon(int index) { if (index == -1) { index = UnityEngine.Random.Range(0, 3); } this.regularWeapons[index].SetActive(true); HeldItemIdentifier component = this.regularWeapons[index].GetComponent <HeldItemIdentifier>(); if (component) { if (SteamDSConfig.isDedicatedServer) { return(true); } if (LocalPlayer.Inventory && LocalPlayer.Inventory.Owns(component._itemId, true)) { this.hasRegularWeapon = true; return(true); } } this.regularWeapons[index].SetActive(false); return(false); }