예제 #1
0
    private void OnTriggerEnter(Collider other)
    {
        // 다른 챔피언과 충돌한 적 있는지 검사
        if (isFirstAtk)
        {
            bool isTrig = false;

            // 현재 충돌한 적에 따라 각각의 HitMe 함수를 호출하고 체력을 회복한다
            if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Champion")))
            {
                if (other.gameObject.Equals(mySkill.gameObject))
                {
                    return;
                }

                ChampionBehavior champBehav = other.GetComponent <ChampionBehavior>();

                if (champBehav.team != mySkill.TheChampionBehaviour.team)
                {
                    isTrig = true;
                    float damage = CalculateDamage();

                    if (champBehav != null)
                    {
                        int x2 = 1;
                        ChampionSound.instance.PlayOtherFx(champBehav.GetComponentInChildren <AudioSource>(), ChampionSound.instance.Mundo_Q_Hit);
                        champBehav.HitMe(damage, "AP", mySkill.gameObject, mySkill.name);
                        mySkill.activeMundoQEffect(champBehav.transform.position);
                        mySkill.Heal(damage * x2);
                    }
                }
            }
            else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Monster")))
            {
                MonsterBehaviour monBehav = other.GetComponent <MonsterBehaviour>();
                float            damage   = CalculateDamage();

                if (monBehav != null)
                {
                    isTrig = true;
                    int x2 = 1;

                    if (monBehav.HitMe(damage, "AP", mySkill.gameObject))
                    {
                        x2 = 2;
                        mySkill.TheChampionAtk.ResetTarget();
                    }

                    mySkill.Heal(damage * x2);
                }
            }
            else if (other.tag.Equals("Minion"))
            {
                MinionBehavior minBehav = other.GetComponent <MinionBehavior>();

                if (!other.name.Contains(mySkill.TheChampionBehaviour.team))
                {
                    isTrig = true;
                    float damage = CalculateDamage();

                    if (minBehav != null)
                    {
                        ChampionSound.instance.PlayOtherFx(minBehav.audio, ChampionSound.instance.Mundo_Q_Hit);
                        int x2 = 1;
                        minBehav.HitMe(damage, "AP", mySkill.gameObject);
                        mySkill.activeMundoQEffect(minBehav.transform.position);
                        mySkill.Heal(damage * x2);
                    }
                }
            }

            // 피격당한 게 확인되면 isFirstAtk을 꺼 다른 이에게 충돌할 일이 없도록 처리한다.
            if (isTrig)
            {
                gameObject.SetActive(false);
                isFirstAtk = false;
            }
        }
    }
예제 #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (firstAtk)
        {
            bool trig = false;
            if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Champion")))
            {
                if (other.gameObject.Equals(mySkill.gameObject))
                {
                    return;
                }
                ChampionBehavior cB = other.GetComponent <ChampionBehavior>();
                if (cB.Team != mySkill.TheChampionBehaviour.Team)
                {
                    trig = true;
                    float damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                                   + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
                    if (cB != null)
                    {
                        //int viewID = mB.GetComponent<PhotonView>().viewID;
                        //mySkill.HitRPC(viewID, damage, "AP");
                        int x2 = 1;
                        ChampionSound.instance.PlayOtherFx(cB.GetComponentInChildren <AudioSource>(), ChampionSound.instance.Mundo_Q_Hit);
                        if (cB.HitMe(damage, "AP", mySkill.gameObject, mySkill.name))
                        {
                            x2 = 2;
                            mySkill.TheChampionAtk.ResetTarget();
                            if (!sysmsg)
                            {
                                sysmsg = GameObject.FindGameObjectWithTag("SystemMsg").GetComponent <SystemMessage>();
                            }
                            sysmsg.sendKillmsg("mundo", other.GetComponent <ChampionData>().ChampionName, mySkill.TheChampionBehaviour.Team.ToString());
                            // 스킬쏜애 주인이 나면 킬올리자
                            if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                            {
                                mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 0, other.transform.position);
                            }
                        }
                        mySkill.Heal(damage * x2);
                    }
                }
            }
            else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Monster")))
            {
                MonsterBehaviour mB     = other.GetComponent <MonsterBehaviour>();
                float            damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                                          + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
                if (mB != null)
                {
                    trig = true;
                    //int viewID = mB.GetComponent<PhotonView>().viewID;
                    //mySkill.HitRPC(viewID, damage, "AP");
                    int x2 = 1;
                    //몬스터 오디오 처리하면 켤것
                    //ChampionSound.instance.PlayOtherFx(mB.GetComponentInChildren<AudioSource>(), ChampionSound.instance.Mundo_Q_Hit);
                    if (mB.HitMe(damage, "AP", mySkill.gameObject))
                    {
                        x2 = 2;
                        mySkill.TheChampionAtk.ResetTarget();

                        //// 스킬쏜애 주인이 나면 킬올리자
                        //if (mySkill.GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player))
                        //{
                        //    mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 3, other.transform.position);

                        //}
                    }
                    mySkill.Heal(damage * x2);
                }
            }
            else if (other.tag.Equals("Minion"))
            {
                MinionBehavior mB = other.GetComponent <MinionBehavior>();
                if (!other.name.Contains(mySkill.TheChampionBehaviour.Team))
                {
                    trig = true;
                    float damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                                   + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
                    if (mB != null)
                    {
                        //int viewID = mB.GetComponent<PhotonView>().viewID;
                        //mySkill.HitRPC(viewID, damage, "AP");
                        ChampionSound.instance.PlayOtherFx(mB.Audio, ChampionSound.instance.Mundo_Q_Hit);
                        int x2 = 1;
                        if (mB.HitMe(damage, "AP", mySkill.gameObject))
                        {
                            x2 = 2;
                            mySkill.TheChampionAtk.ResetTarget();

                            // 스킬쏜애 주인이 나면 킬올리자
                            if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                            {
                                mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 1, other.transform.position);
                            }
                        }
                        mySkill.Heal(damage * x2);
                    }
                }
            }

            if (trig)
            {
                gameObject.SetActive(false);
                firstAtk = false;
            }
        }
    }