private IEnumerator spawnPlacedPrefab(Transform currentArtifact) { Vector3 spawnPos = currentArtifact.position; Vector3 castPos = spawnPos; castPos.y += 3f; RaycastHit hit; if (Physics.Raycast(castPos, Vector3.down, out hit, 10f, this.mask, QueryTriggerInteraction.Ignore)) { spawnPos = hit.point; spawnPos.y += 1.5f; } spawnPos.y += 0.15f; this.spawnedArtifactInWorld = UnityEngine.Object.Instantiate <GameObject>(this.placedPrefab, spawnPos, Quaternion.LookRotation(Vector3.down)); yield return(this.spawnedArtifactInWorld); artifactBallController controller = currentArtifact.GetComponent <artifactBallController>(); artifactBallPlacedController abpc = this.spawnedArtifactInWorld.transform.GetComponent <artifactBallPlacedController>(); if (abpc) { abpc.setSpinSpeed(controller.spin); abpc.setArtifactState(controller.currentStateIndex); } LocalPlayer.Inventory.RemoveItem(this._artifactId, 1, false, false); base.Invoke("equipPreviousWeapon", 1f); yield break; }
private void Collect() { if (this._pendingdestroythroughbolt) { return; } if (this._fakeArrowPickup) { base.transform.parent.SendMessage("sendRemoveArrow", SendMessageOptions.DontRequireReceiver); } if (this._unparentArrows) { CoopWeaponArrowFire componentInChildren = base.transform.parent.GetComponentInChildren <CoopWeaponArrowFire>(); if (componentInChildren) { componentInChildren.transform.parent = null; } } if (this._firstTimePickup) { if (LocalPlayer.Animator) { LocalPlayer.Animator.SetBool("firstTimePickup", true); } } else if (LocalPlayer.Animator) { LocalPlayer.Animator.SetBool("firstTimePickup", false); } if (base.transform.parent) { artifactBallPlacedController componentInParent = base.transform.GetComponentInParent <artifactBallPlacedController>(); if (componentInParent) { componentInParent.setHeldArtifactState(); } } if (this._hairSprayFuel && LocalPlayer.Stats.hairSprayFuel.CurrentFuel < LocalPlayer.Stats.hairSprayFuel.MaxFuelCapacity) { LocalPlayer.Stats.hairSprayFuel.CurrentFuel = LocalPlayer.Stats.hairSprayFuel.MaxFuelCapacity; } this.CheckTrappedAnimal(); if (this.MainEffect() || this._destroyIfFull) { if (this._positionHashSaving) { GlobalDataSaver.SetInt(base.transform.ToGeoHash(), 1); } this.CollectBonuses(); if (this._spiderDice && UnityEngine.Random.Range(0, 4) == 2) { UnityEngine.Object.Instantiate(Resources.Load("Spider"), base.transform.position, base.transform.rotation); } if (this._spawnAfterPickupPrefab) { Vector3 vector = base.transform.position; if (this._useSkinAnimalRoutine) { vector += LocalPlayer.Transform.forward * 1.1f; } if (!BoltNetwork.isRunning || !this._spawnAfterPickupPrefab.GetComponent <BoltEntity>()) { UnityEngine.Object.Instantiate <GameObject>(this._spawnAfterPickupPrefab, vector, Quaternion.identity); } else { BoltNetwork.Instantiate(this._spawnAfterPickupPrefab, vector, Quaternion.identity); } if (this._spawnAfterPickupPrefab2) { if (!BoltNetwork.isRunning || !this._spawnAfterPickupPrefab2.GetComponent <BoltEntity>()) { UnityEngine.Object.Instantiate <GameObject>(this._spawnAfterPickupPrefab2, vector, Quaternion.identity); } else { BoltNetwork.Instantiate(this._spawnAfterPickupPrefab2, vector, Quaternion.identity); } } } if (!this.TryPool() && !this._infinite) { this.ClearOut(false); } } else if (!this._preventFakeDrop) { if (this._positionHashSaving) { GlobalDataSaver.SetInt(base.transform.ToGeoHash(), 1); } if (this._spawnAfterPickupPrefab) { Vector3 vector2 = base.transform.position; if (this._useSkinAnimalRoutine) { vector2 += LocalPlayer.Transform.forward * 1.1f; } if (!BoltNetwork.isRunning || !this._spawnAfterPickupPrefab.GetComponent <BoltEntity>()) { UnityEngine.Object.Instantiate <GameObject>(this._spawnAfterPickupPrefab, vector2, Quaternion.identity); } else { BoltNetwork.Instantiate(this._spawnAfterPickupPrefab, vector2, Quaternion.identity); } if (this._spawnAfterPickupPrefab2) { if (!BoltNetwork.isRunning || !this._spawnAfterPickupPrefab2.GetComponent <BoltEntity>()) { UnityEngine.Object.Instantiate <GameObject>(this._spawnAfterPickupPrefab2, vector2, Quaternion.identity); } else { BoltNetwork.Instantiate(this._spawnAfterPickupPrefab2, vector2, Quaternion.identity); } } } this.ClearOut(true); } }