Example #1
0
            private void OnParticleCollision(GameObject other)
            {
                //적이 사용
                if (!proMove.IsPlayerBullet)
                {
                    if (other.transform.tag.Equals("Player"))
                    {
                        proMove.HitEffect();

                        if (proMove.IsStun)
                        {
                            other.GetComponent <HitDmg>().StunDelayAni(proMove.FStunPer); //기절 효과(데미지는 밑에서 처리)
                        }
                        Transform target = other.GetComponent <PlayerCtrl>()._DmgUI;
                        other.GetComponent <HitDmg>().HitDmage(target, Random.Range(proMove.MinDmg, proMove.MaxDmg));
                        other.GetComponent <UIBar>().HpBar();
                    }
                }

                // 플레이어의 사용
                else if (proMove.IsPlayerBullet)
                {
                    if (other.transform.tag.Equals("Enemy"))
                    {
                        proMove.HitEffect();

                        if (proMove.IsExplosion)
                        {
                            ExplosionDmg();
                        }

                        if (proMove.IsStun)
                        {
                            other.GetComponent <HitDmg>().StunDelayAni(proMove.FStunPer); //기절 효과(데미지는 밑에서 처리)
                        }
                        Transform target = other.GetComponent <EnemyCtrl>()._HitInfo;
                        other.GetComponent <HitDmg>().HitDmage(target, Random.Range(proMove.MinDmg, proMove.MaxDmg)); //기본 데미지
                    }
                }
            }
Example #2
0
            /// <summary>
            /// 피격 시 데미지
            /// </summary>
            /// <param name="other"></param>
            private void OnTriggerEnter(Collider other)
            {
                //Debug.Log("Coll");

                //적 캐릭터의 탄일경우 플레이어만 확인한다
                if (!proMove.IsPlayerBullet)
                {
                    if (other.transform.tag.Equals("Player"))
                    {
                        proMove.HitEffect();
                        BulletHitEffect();

                        //if (proMove.IsExplosion) //폭발 효과 데미지(범위 공격)
                        //    ExplosionDmg();

                        if (proMove.IsStun)
                        {
                            other.GetComponent <HitDmg>().StunDelayAni(proMove.FStunPer); //기절 효과(데미지는 밑에서 처리)
                        }
                        Transform target = other.GetComponent <PlayerCtrl>()._DmgUI;
                        other.GetComponent <HitDmg>().HitDmage(target, Random.Range(proMove.MinDmg, proMove.MaxDmg));
                        other.GetComponent <UIBar>().HpBar();

                        /* 나중에 HP말고 Mana등 다른 수치에 데미지를 줄 경우 UI 동기화
                         * other.GetComponent<UIBar>().ManaBar();
                         * other.GetComponent<UIBar>().SatietyBar();
                         * other.GetComponent<UIBar>().ThirstBar();
                         */
                        gameObject.SetActive(false);
                    }
                }
                //플레이어의 탄일 경우 적 캐릭터만 확인한다
                else if (proMove.IsPlayerBullet)
                {
                    if (other.transform.tag.Equals("Enemy"))
                    {
                        proMove.HitEffect();
                        BulletHitEffect();


                        if (proMove.IsExplosion) //폭발 효과 데미지(범위 공격)
                        {
                            ExplosionDmg();
                        }

                        if (proMove.IsStun && other.GetComponent <HitDmg>())
                        {
                            other.GetComponent <HitDmg>().StunDelayAni(proMove.FStunPer); //기절 효과(데미지는 밑에서 처리)
                        }
                        //Debug.Log("Enemy Attack");
                        if (other.GetComponent <EnemyCtrl>())
                        {
                            Transform target = other.GetComponent <EnemyCtrl>()._HitInfo;
                            other.GetComponent <HitDmg>().HitDmage(target, Random.Range(proMove.MinDmg, proMove.MaxDmg)); //기본 데미지
                        }

                        gameObject.SetActive(false);
                    }
                }

                if (other.transform.tag.Equals("OBS"))
                {
                    //장애물 충돌 시 플레이어 탄이면서 폭발 속성이 있으면
                    if (proMove.IsPlayerBullet && proMove.IsExplosion)
                    {
                        ExplosionDmg();
                    }

                    BulletHitEffect();
                    gameObject.SetActive(false);
                }
            }