コード例 #1
0
ファイル: ExplosionColl.cs プロジェクト: rainbowkjh/UnityGame
            private void OnTriggerEnter(Collider other)
            {
                if (!isEnter)
                {
                    if (other.transform.CompareTag(triggerTag))
                    {
                        //폭발 이벤트를 해당 태그가
                        //감지 될때마다 발생하는 것을 막는다
                        if (!isExplosionRot)
                        {
                            isEnter = true;
                        }

                        Manager.GameManager.INSTANCE.SFXPlay(_audio, _sfx);

                        for (int i = 0; i < explosionPar.Length; i++)
                        {
                            explosionPar[i].gameObject.SetActive(true);
                            if (!explosionPar[i].isPlaying)
                            {
                                explosionPar[i].Play();
                            }
                        }



                        //리지디 바디가 있으면
                        //폭빌 효과로 튕겨(?) 낸다
                        Rigidbody rid = other.GetComponent <Rigidbody>();
                        if (rid != null)
                        {
                            rid.useGravity = enabled;
                            rid.AddForce(exploVec * addForce, ForceMode.Impulse);
                        }

                        if (isRot)
                        {
                            rid.GetComponent <Veh.VehCtrl>().IsRot = true;
                        }

                        if (isSlow)
                        {
                            rid.GetComponent <Veh.VehCtrl>().IsSlow = true;
                        }

                        if (isShake)
                        {
                            StartCoroutine(shake.ShakeCamAct(0.2f, 0.5f, 0.5f));
                        }
                    }
                }
            }
コード例 #2
0
ファイル: CreateObjCtrl.cs プロジェクト: rainbowkjh/UnityGame
            IEnumerator CreateDelay(float delay)
            {
                isCreate = true;
                for (int i = 0; i < createObj.Length; i++)
                {
                    createObj[i].SetActive(true);

                    if (isShake)
                    {
                        StartCoroutine(shakeCam.ShakeCamAct(0.2f, 0.5f, 0.5f));
                    }

                    yield return(new WaitForSeconds(delay));
                }
            }