// Use this for initialization void Start() { gc = GameObject.Find("GameController").GetComponent <GameController>(); _parent = GameObject.Find("ThrowObjects").transform; //dust = GetComponent<DustEffect>(); kariDust = GetComponent <DustEffectkari>(); GetMaterial(); }
IEnumerator Throw() { Debug.Log(safetyLock); if (runCoroutine == true || safetyLock == false) { yield break; } runCoroutine = true; yield return(new WaitForSecondsRealtime(0.5f)); if (throwObject == null) { isCatch = false; runCoroutine = false; yield break; } if (throwObject.GetComponent <ObjectController>() != null) { throwObject.GetComponent <ObjectController>().thrown = true; } DustEffectkari dustEffect = throwObject.GetComponent <DustEffectkari>(); dustEffect.IsDust = true; dustEffect.playerNum = playerNum; rb.isKinematic = false; _animator.SetBool("Throw", true); Vector3 throwSpeed = (transform.TransformDirection(Vector3.forward) * throwPower + Vector3.up * (throwPower / 1.2f)); rb.velocity = throwSpeed; SeManager.Instance.PlayerSe(playerNum, 2); throwObject.transform.parent = null; throwObject = null; if (otherPlayer != null) { otherPlayer.throwHasPlayer = this.gameObject; _plusPoint += 50; PointUpdate(); otherPlayer = null; } else if (oc != null) { oc = null; } isCatch = false; _animator.SetBool("Catch", false); _animator.SetBool("CatchPlayer", false); _animator.SetFloat("CatchDelay", 0); yield return(new WaitForSecondsRealtime(1f)); runCoroutine = false; yield break; }