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 setHeldArtifactState(int set) { if (this.heldArtifactGo) { artifactBallController component = this.heldArtifactGo.GetComponent <artifactBallController>(); if (component) { component.forceArtifactState(set); } } }