示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        //충돌한 적의 종류에 따라 각각의 HitMe 함수를 호출한다
        if (other.tag.Equals("Minion"))
        {
            MinionBehavior minBehav = other.GetComponent <MinionBehavior>();

            if (!other.gameObject.name.Contains(mySkill.TheChampionBehaviour.team))
            {
                minBehav.minAtk.PauseAtk(1f, true);
                float damage = CalculateDamage();

                if (minBehav != null)
                {
                    int viewID = minBehav.GetComponent <PhotonView>().viewID;
                    minBehav.HitMe(damage, "AP", mySkill.gameObject);
                }
            }
        }
        else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Champion")))
        {
            ChampionBehavior champBehav = other.GetComponent <ChampionBehavior>();

            if (champBehav.team != mySkill.TheChampionBehaviour.team)
            {
                champBehav.myChampAtk.PauseAtk(1f, true);
                float damage = CalculateDamage();

                if (champBehav != null)
                {
                    int viewID = champBehav.GetComponent <PhotonView>().viewID;
                    champBehav.HitMe(damage, "AP", mySkill.gameObject, mySkill.name);
                }
            }
        }
        else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Monster")))
        {
            MonsterBehaviour monBehav = other.GetComponent <MonsterBehaviour>();
            monBehav.monAtk.PauseAtk(1f, true);
            float damage = CalculateDamage();

            if (monBehav != null)
            {
                int viewID = monBehav.GetComponent <PhotonView>().viewID;
                monBehav.HitMe(damage, "AP", mySkill.gameObject);
            }
        }
    }
示例#2
0
    /// <summary>
    /// 공격을 담당하는 코루틴
    /// </summary>
    IEnumerator Attack()
    {
        while (!myChampBehav.isDead)
        {
            if (!isAtkPause)
            {
                bool isCheck = true;

                if (!isTargetting)
                {
                    isCheck = false;
                }
                else if (atkTargetObj == null)
                {
                    isCheck = false;
                }
                else if (atkTargetObj.Equals(aStarTargetObj))
                {
                    isCheck = false;
                }

                //타겟이 있다면 공격
                if (isCheck)
                {
                    myChampBehav.transform.DOLookAt(atkTargetObj.transform.position, 0);

                    //공격하는 대상과 피격당하는 대상을 구분하여 처리
                    if (atkTargetObj.tag.Equals("Minion"))
                    {
                        MakeAsheArrow();

                        MinionBehavior minBehav = atkTargetObj.GetComponent <MinionBehavior>();
                        AudioSource    minAudio = minBehav.transform.GetChild(minBehav.transform.childCount - 1).GetComponent <AudioSource>();

                        if (minBehav != null)
                        {
                            int viewID = minBehav.GetComponent <PhotonView>().viewID;
                            myChampBehav.HitRPC(viewID);
                            ChampionSound.instance.IamAttackedSound(minAudio, champName);

                            if (isAshe)
                            {
                                asheSkill.QCountUp();
                            }

                            minBehav.HitMe(myChampionData.totalStat.AttackDamage, "AD", myChampBehav.gameObject);

                            if (!skillKey.Equals(""))
                            {
                                if (--skillKeyNum < 1)
                                {
                                    skillKey = "";
                                }
                            }
                        }
                    }
                    else if (atkTargetObj.layer.Equals(LayerMask.NameToLayer("Champion")))
                    {
                        MakeAsheArrow();

                        ChampionBehavior champBehav = atkTargetObj.GetComponent <ChampionBehavior>();
                        AudioSource      champaudio = champBehav.gameObject.GetComponent <AudioSource>();

                        if (champBehav != null)
                        {
                            int viewID = champBehav.GetComponent <PhotonView>().viewID;
                            myChampBehav.HitRPC(viewID);
                            ChampionSound.instance.IamAttackedSound(champaudio, champName);

                            if (isAshe)
                            {
                                asheSkill.QCountUp();
                            }

                            champBehav.HitMe(myChampionData.totalStat.AttackDamage, "AD", myChampBehav.gameObject, myChampBehav.name);

                            if (!skillKey.Equals(""))
                            {
                                if (--skillKeyNum < 1)
                                {
                                    skillKey = "";
                                }
                            }
                        }
                    }
                    else if (atkTargetObj.tag.Equals("Tower"))
                    {
                        MakeAsheArrow();
                        TowerBehaviour towerBehav = atkTargetObj.GetComponent <TowerBehaviour>();
                        AudioSource    towerAudio = towerBehav.GetComponent <AudioSource>();

                        if (towerBehav != null)
                        {
                            string key     = "";
                            char[] keyChar = towerBehav.gameObject.name.ToCharArray();

                            for (int i = 13; i < 16; ++i)
                            {
                                key += keyChar[i];
                            }

                            myChampBehav.HitRPC(key);
                            ChampionSound.instance.IamAttackedSound(towerAudio, champName);

                            if (isAshe)
                            {
                                asheSkill.QCountUp();
                            }

                            // 타워를 파괴 시 팀의 cs, 골드, 경험치를 올린다
                            if (towerBehav.HitMe(myChampionData.totalStat.AttackDamage))
                            {
                                myChampionData.Kill_CS_Gold_Exp(atkTargetObj.name, 2, atkTargetObj.transform.position);
                                ResetTarget();
                            }

                            if (!skillKey.Equals(""))
                            {
                                if (--skillKeyNum < 1)
                                {
                                    skillKey = "";
                                }
                            }
                        }
                    }
                    else if (atkTargetObj.tag.Equals("Suppressor"))
                    {
                        MakeAsheArrow();
                        SuppressorBehaviour supBehav = atkTargetObj.GetComponent <SuppressorBehaviour>();

                        if (supBehav != null)
                        {
                            string key     = "";
                            char[] keyChar = supBehav.gameObject.name.ToCharArray();

                            for (int i = 11; i < 14; ++i)
                            {
                                key += keyChar[i];
                            }

                            myChampBehav.HitRPC(key);

                            if (isAshe)
                            {
                                asheSkill.QCountUp();
                            }

                            supBehav.HitMe(myChampionData.totalStat.AttackDamage);

                            if (!skillKey.Equals(""))
                            {
                                if (--skillKeyNum < 1)
                                {
                                    skillKey = "";
                                }
                            }
                        }
                    }
                    else if (atkTargetObj.tag.Equals("Nexus"))
                    {
                        MakeAsheArrow();
                        SuppressorBehaviour supBehav = atkTargetObj.GetComponent <SuppressorBehaviour>();

                        if (supBehav != null)
                        {
                            string key     = "";
                            char[] keyChar = supBehav.gameObject.name.ToCharArray();
                            key += keyChar[6];
                            myChampBehav.HitRPC(key);

                            if (isAshe)
                            {
                                asheSkill.QCountUp();
                            }

                            supBehav.HitMe(myChampionData.totalStat.AttackDamage);

                            if (!skillKey.Equals(""))
                            {
                                if (--skillKeyNum < 1)
                                {
                                    skillKey = "";
                                }
                            }
                        }
                    }
                    else if (atkTargetObj.layer.Equals(LayerMask.NameToLayer("Monster")))
                    {
                        MakeAsheArrow();
                        MonsterBehaviour monBehav = atkTargetObj.GetComponent <MonsterBehaviour>();

                        if (monBehav != null)
                        {
                            int viewID = monBehav.GetComponent <PhotonView>().viewID;
                            myChampBehav.HitRPC(viewID);

                            if (isAshe)
                            {
                                asheSkill.QCountUp();
                            }

                            monBehav.HitMe(myChampionData.totalStat.AttackDamage, "AD", myChamp);

                            if (!skillKey.Equals(""))
                            {
                                if (--skillKeyNum < 1)
                                {
                                    skillKey = "";
                                }
                            }
                        }
                    }
                }
            }

            float AtkSpeed = myChampionData.myStat.AttackSpeed * (1 + (myChampionData.totalStat.UP_AttackSpeed * (myChampionData.totalStat.Level - 1) + (myChampionData.totalStat.AttackSpeed - myChampionData.myStat.AttackSpeed)) / 100);
            //어택 딜레이타임을 1초로 설정
            atkDelayTime = 1f / AtkSpeed;

            yield return(new WaitForSeconds(atkDelayTime));
        }
    }
示例#3
0
    public override void W()
    {
        InitTempValue();
        OnMove();
        HitEffectRPC("Alistar", "W");
        GameObject obj = SkillObj["W"][0];

        if (obj.activeInHierarchy)
        {
            Pooling(QSkillprefab, "W", 10);
            obj = SkillObj["W"][0];
        }
        SkillObj["W"].RemoveAt(0);
        SkillObj["W"].Add(obj);
        obj.transform.position = transform.position;
        obj.SetActive(true);
        if (TempObject1.tag.Equals("Minion"))
        {
            MinionBehavior mB = TempObject1.GetComponent <MinionBehavior>();
            if (!TempObject1.gameObject.name.Contains(TheChampionBehaviour.Team))
            {
                MinionAtk mA = mB.minAtk;
                //mA.PushMe(Vector3.up * 3 + TempObject1.transform.position
                //    + (((TempObject1.transform.position - TempVector1).normalized) * 5), 0.5f);
                Vector3 direction = (TempObject1.transform.position - TempVector1).normalized;
                Vector3 v         = TempObject1.transform.position
                                    + (direction * 10);;
                RaycastHit hit;
                if (Physics.Raycast(mA.transform.position, direction, out hit, 12, 1 << LayerMask.NameToLayer("WallCollider")))
                {
                    float dis = Vector3.Distance(hit.point, TempObject1.transform.position);
                    v = TempObject1.transform.position
                        + (direction * (dis - 1f));
                }

                v.y = 0;
                mA.PushMe(v, 0.5f);
                mA.PauseAtk(1f, true);
                float damage = skillData.wDamage[TheChampionData.skill_W - 1]
                               + Acalculate(skillData.wAstat, skillData.wAvalue);

                if (mB != null)
                {
                    int viewID = mB.GetComponent <PhotonView>().viewID;
                    HitRPC(viewID, damage, "AP", "Push");
                    if (mB.HitMe(damage, "AP", gameObject))
                    {
                        //여기에는 나중에 평타 만들면 플레이어의 현재 공격 타겟이 죽었을 시 초기화해주는 것을 넣자.
                        TheChampionAtk.ResetTarget();

                        // 스킬쏜애 주인이 나면 킬올리자
                        if (GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                        {
                            TheChampionData.Kill_CS_Gold_Exp(TempObject1.gameObject.name, 1, TempObject1.transform.position);
                        }
                    }
                }
            }
        }
        //else if (TempObject1.tag.Equals("Player"))
        else if (TempObject1.layer.Equals(LayerMask.NameToLayer("Champion")))
        {
            ChampionBehavior cB = TempObject1.GetComponent <ChampionBehavior>();
            if (cB.Team != TheChampionBehaviour.Team)
            {
                ChampionAtk cA        = cB.myChampAtk;
                Vector3     direction = (TempObject1.transform.position - TempVector1).normalized;
                Vector3     v         = TempObject1.transform.position
                                        + (direction * 5);;
                RaycastHit hit;
                if (Physics.Raycast(cA.transform.position, direction, out hit, 6, 1 << LayerMask.NameToLayer("WallCollider")))
                {
                    float dis = Vector3.Distance(hit.point, TempObject1.transform.position);
                    v = TempObject1.transform.position
                        + (direction * (dis - 1f));
                }

                v.y = 0.5f;
                cA.PushMe(v, 0.5f);
                cA.PauseAtk(1f, true);
                float damage = skillData.wDamage[TheChampionData.skill_W - 1]
                               + Acalculate(skillData.wAstat, skillData.wAvalue);

                if (cB != null)
                {
                    int viewID = cB.GetComponent <PhotonView>().viewID;
                    HitRPC(viewID, damage, "AP", "Push");
                    if (cB.HitMe(damage, "AP", gameObject, gameObject.name))
                    {
                        TheChampionAtk.ResetTarget();
                        if (!sysmsg)
                        {
                            sysmsg = GameObject.FindGameObjectWithTag("SystemMsg").GetComponent <SystemMessage>();
                        }
                        //sysmsg.sendKillmsg("alistar", TempObject1.GetComponent<ChampionData>().ChampionName, TheChampionBehaviour.Team.ToString());
                        // 스킬쏜애 주인이 나면 킬올리자
                        //if (GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player))
                        //{

                        //    TheChampionData.Kill_CS_Gold_Exp(TempObject1.gameObject.name, 0, TempObject1.transform.position);
                        //}
                    }
                }
            }
        }
        else if (TempObject1.layer.Equals(LayerMask.NameToLayer("Monster")))
        {
            MonsterBehaviour mB        = TempObject1.GetComponent <MonsterBehaviour>();
            MonsterAtk       mA        = mB.monAtk;
            Vector3          direction = (TempObject1.transform.position - TempVector1).normalized;
            Vector3          v         = TempObject1.transform.position
                                         + (direction * 5);;
            RaycastHit hit;
            if (Physics.Raycast(mA.transform.position, direction, out hit, 6, 1 << LayerMask.NameToLayer("WallCollider")))
            {
                float dis = Vector3.Distance(hit.point, TempObject1.transform.position);
                v = TempObject1.transform.position
                    + (direction * (dis - 1f));
            }

            v.y = 0;
            mA.PushMe(v, 0.5f);
            mA.PauseAtk(1f, true);
            float damage = skillData.wDamage[TheChampionData.skill_W - 1]
                           + Acalculate(skillData.wAstat, skillData.wAvalue);

            if (mB != null)
            {
                int viewID = mB.GetComponent <PhotonView>().viewID;
                HitRPC(viewID, damage, "AP", "Push");
                if (mB.HitMe(damage, "AP", gameObject))
                {
                    TheChampionAtk.ResetTarget();

                    //// 스킬쏜애 주인이 나면 킬올리자
                    //if (GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player))
                    //{
                    //    TheChampionData.Kill_CS_Gold_Exp(TempObject1.gameObject.name, 3, TempObject1.transform.position);
                    //}
                }
            }
        }
        skillselect = SSelect.none;
    }
示例#4
0
    /// <summary>
    /// 공격을 담당하는 코루틴
    /// </summary>
    IEnumerator Attack()
    {
        while (true)
        {
            if (!isAtkPause)
            {
                bool isCheck = true;

                if (nowTarget == null)
                {
                    isCheck = false;
                }
                else if (!nowTarget.activeInHierarchy)
                {
                    isCheck = false;
                }

                //타겟이 있다면 공격
                if (isCheck)
                {
                    if (anim.GetBool("walking"))
                    {
                        anim.SetBool("walking", false);
                    }

                    anim.SetTrigger("attack");
                    Vector3 v = nowTarget.transform.position;
                    v.y = 0;
                    myMinion.transform.DOLookAt(v, 1);

                    //공격하는 대상과 피격당하는 대상을 구분하여 처리
                    if (nowTarget.tag.Equals("Minion"))
                    {
                        if (myMinion.name.Contains("Melee"))
                        {
                            MinionBehavior minBehav = nowTarget.GetComponent <MinionBehavior>();

                            if (minBehav != null)
                            {
                                int viewID = minBehav.GetComponent <PhotonView>().viewID;
                                myBehav.HitRPC(viewID);
                                minBehav.HitMe(myBehav.stat.AttackDamage);
                            }
                        }
                        else if (myMinion.name.Contains("Magician"))
                        {
                            float moveTime = 0.4f;
                            myBehav.ArrowRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                        else if (myMinion.name.Contains("Siege"))
                        {
                            float moveTime = 0.4f;
                            myBehav.CannonballRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                    }
                    else if (nowTarget.layer.Equals(LayerMask.NameToLayer("Champion")))
                    {
                        if (myMinion.name.Contains("Melee"))
                        {
                            ChampionBehavior champBehav = nowTarget.GetComponent <ChampionBehavior>();

                            if (champBehav != null)
                            {
                                int viewID = champBehav.GetComponent <PhotonView>().viewID;
                                myBehav.HitRPC(viewID);
                                champBehav.HitMe(myBehav.stat.AttackDamage, "AD", myMinion, myMinion.name);
                            }
                        }
                        else if (myMinion.name.Contains("Magician"))
                        {
                            float moveTime = 0.4f;
                            myBehav.ArrowRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                        else if (myMinion.name.Contains("Siege"))
                        {
                            float moveTime = 0.4f;
                            myBehav.CannonballRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                    }
                    else if (nowTarget.tag.Equals("Tower"))
                    {
                        if (myMinion.name.Contains("Melee"))
                        {
                            TowerBehaviour towerBehav = nowTarget.GetComponent <TowerBehaviour>();

                            if (towerBehav != null)
                            {
                                string key     = "";
                                char[] keyChar = towerBehav.gameObject.name.ToCharArray();

                                for (int i = 13; i < 16; ++i)
                                {
                                    key += keyChar[i];
                                }

                                myBehav.HitRPC(key);

                                if (towerBehav.HitMe(myBehav.stat.AttackDamage))
                                {
                                    if (enemyColor.Equals("Red"))
                                    {
                                        TheInGameManager.blueTeamPlayer[0].GetComponent <PhotonView>().RPC("GlobalGold", PhotonTargets.All, "blue", 100);
                                    }
                                    else
                                    {
                                        TheInGameManager.redTeamPlayer[0].GetComponent <PhotonView>().RPC("GlobalGold", PhotonTargets.All, "red", 100);
                                    }

                                    enemiesList.Remove(nowTarget);
                                }
                            }
                        }
                        else if (myMinion.name.Contains("Magician"))
                        {
                            float moveTime = 0.4f;
                            myBehav.ArrowRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                        else if (myMinion.name.Contains("Siege"))
                        {
                            float moveTime = 0.4f;
                            myBehav.CannonballRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                    }
                    else if (nowTarget.tag.Equals("Suppressor") || nowTarget.tag.Equals("Nexus"))
                    {
                        if (myMinion.name.Contains("Melee"))
                        {
                            SuppressorBehaviour supBehav = nowTarget.GetComponent <SuppressorBehaviour>();

                            if (supBehav != null)
                            {
                                string key     = "";
                                char[] keyChar = supBehav.gameObject.name.ToCharArray();

                                if (nowTarget.tag.Equals("Nexus"))
                                {
                                    key += keyChar[6];
                                }
                                else
                                {
                                    for (int i = 11; i < 14; ++i)
                                    {
                                        key += keyChar[i];
                                    }
                                }

                                myBehav.HitRPC(key);

                                if (supBehav.HitMe(myBehav.stat.AttackDamage))
                                {
                                    enemiesList.Remove(nowTarget);
                                }
                            }
                        }
                        else if (myMinion.name.Contains("Magician"))
                        {
                            float moveTime = 0.4f;
                            myBehav.ArrowRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                        else if (myMinion.name.Contains("Siege"))
                        {
                            float moveTime = 0.4f;
                            myBehav.CannonballRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                    }
                }
            }

            //어택 딜레이타임을 1초로 설정
            atkDelayTime = 1f;

            yield return(new WaitForSeconds(1));
        }
    }
示例#5
0
文件: AlistarQ.cs 项目: kunana/AOS
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag.Equals("Minion")) //나중에챔피언일때도적일때도조건에추가
        {                               //미니언의 경우 트리거 켜진건 공격 추-적 반경이라 디스턴스를 추가
         //if (Vector3.Distance(other.transform.position, transform.position) <= skillRange)
         //{
            MinionBehavior mB = other.GetComponent <MinionBehavior>();
            if (!other.gameObject.name.Contains(mySkill.TheChampionBehaviour.Team))
            {
                mB.minAtk.PauseAtk(1f, true);
                //other.GetComponent<Rigidbody>().AddForce(0, upPower, 0);
                //s = other.transform.DOJump(other.transform.position, 3, 1, 1f).OnUpdate(() => { if (mB.isDead) if (s != null) s.Kill(); });
                float damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                               + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
                //공격 코드(데미지 등) 삽입'
                //float damage = mySkill.QSkillInfo.myskill.Damage[mySkill.QSkillInfo.myskill.skillLevel]
                //    + mySkill.QSkillInfo.Acalculate(mySkill.QSkillInfo.myskill.Astat, mySkill.QSkillInfo.myskill.Avalue);

                if (mB != null)
                {
                    int viewID = mB.GetComponent <PhotonView>().viewID;
                    //mySkill.HitRPC(viewID, damage, "AP", "Jump");
                    if (mB.HitMe(damage, "AP", mySkill.gameObject))
                    {
                        //여기에는 나중에 평타 만들면 플레이어의 현재 공격 타겟이 죽었을 시 초기화해주는 것을 넣자.
                        mySkill.TheChampionAtk.ResetTarget();

                        // 스킬쏜애 주인이 나면 킬올리자
                        if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                        {
                            mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 1, other.transform.position);
                        }
                    }
                }
            }
        }
        //else if (other.tag.Equals("Player"))
        else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Champion")))
        {
            ChampionBehavior cB = other.GetComponent <ChampionBehavior>();
            if (cB.Team != mySkill.TheChampionBehaviour.Team)
            {
                cB.myChampAtk.PauseAtk(1f, true);
                float damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                               + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
                if (cB != null)
                {
                    int viewID = cB.GetComponent <PhotonView>().viewID;
                    //mySkill.HitRPC(viewID, damage, "AP", "Jump");
                    if (cB.HitMe(damage, "AP", mySkill.gameObject, mySkill.name))
                    {
                        mySkill.TheChampionAtk.ResetTarget();
                        if (!sysmsg)
                        {
                            sysmsg = GameObject.FindGameObjectWithTag("SystemMsg").GetComponent <SystemMessage>();
                        }
                        sysmsg.sendKillmsg("alistar", 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);
                        }
                    }
                }
                //s = other.transform.DOJump(other.transform.position, 3, 1, 1f).OnUpdate(() =>
                //{
                //    if (cB.myChampionData.totalstat.Hp - ((damage * 100f) / (100f + cB.myChampionData.totalstat.Ability_Def)) <= 1)
                //    {
                //        if (s != null)
                //            s.Kill();
                //    }
                //});
            }
        }
        else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Monster")))
        {
            MonsterBehaviour mB = other.GetComponent <MonsterBehaviour>();
            mB.monAtk.PauseAtk(1f, true);
            //s = other.transform.DOJump(other.transform.position, 3, 1, 1f).OnUpdate(() => { if (mB.isDead) if (s != null) s.Kill(); });
            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", "Jump");
                if (mB.HitMe(damage, "AP", mySkill.gameObject))
                {
                    mySkill.TheChampionAtk.ResetTarget();

                    //// 스킬쏜애 주인이 나면 킬올리자
                    //if (mySkill.GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player))
                    //{
                    //    mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 3, other.transform.position);
                    //}
                }
            }
        }
    }
示例#6
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag.Equals("Minion"))
        {
            MinionBehavior mB = other.GetComponent <MinionBehavior>();
            if (!other.gameObject.name.Contains(mySkill.TheChampionBehaviour.Team))
            {
                float damage = (mySkill.skillData.eDamage[mySkill.TheChampionData.skill_E - 1]
                                + mySkill.Acalculate(mySkill.skillData.eAstat, mySkill.skillData.eAvalue)) / 10f;
                if (mB != null)
                {
                    int viewID = mB.GetComponent <PhotonView>().viewID;
                    //mySkill.HitRPC(viewID, damage, "AP");
                    if (mB.HitMe(damage, "AP", mySkill.gameObject))
                    {
                        //여기에는 나중에 평타 만들면 플레이어의 현재 공격 타겟이 죽었을 시 초기화해주는 것을 넣자.
                        mySkill.TheChampionAtk.ResetTarget();

                        // 스킬쏜애 주인이 나면 킬올리자
                        if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                        {
                            mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 1, other.transform.position);
                        }
                    }
                }
            }
        }
        //else if(other.tag.Equals("Player"))
        else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Champion")))
        {
            ChampionBehavior cB = other.GetComponent <ChampionBehavior>();
            if (cB.Team != mySkill.TheChampionBehaviour.Team)
            {
                float damage = (mySkill.skillData.eDamage[mySkill.TheChampionData.skill_E - 1]
                                + mySkill.Acalculate(mySkill.skillData.eAstat, mySkill.skillData.eAvalue)) / 10f;
                if (cB != null)
                {
                    int viewID = cB.GetComponent <PhotonView>().viewID;
                    //mySkill.HitRPC(viewID, damage, "AP");
                    if (cB.HitMe(damage, "AP", mySkill.gameObject, mySkill.name))
                    {
                        mySkill.TheChampionAtk.ResetTarget();
                        if (!sysmsg)
                        {
                            sysmsg = GameObject.FindGameObjectWithTag("SystemMsg").GetComponent <SystemMessage>();
                        }
                        sysmsg.sendKillmsg("alistar", 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);
                        }
                    }
                }
            }
        }
        else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Monster")))
        {
            MonsterBehaviour mB = other.GetComponent <MonsterBehaviour>();

            float damage = (mySkill.skillData.eDamage[mySkill.TheChampionData.skill_E - 1]
                            + mySkill.Acalculate(mySkill.skillData.eAstat, mySkill.skillData.eAvalue)) / 10f;
            if (mB != null)
            {
                int viewID = mB.GetComponent <PhotonView>().viewID;
                //mySkill.HitRPC(viewID, damage, "AP");
                if (mB.HitMe(damage, "AP", mySkill.gameObject))
                {
                    mySkill.TheChampionAtk.ResetTarget();

                    //// 스킬쏜애 주인이 나면 킬올리자
                    //if (mySkill.GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player))
                    //{
                    //    mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 3, other.transform.position);
                    //}
                }
            }
        }
    }
示例#7
0
 IEnumerator AtkMotion()
 {
     while (true)
     {
         if (!isAtkPause)
         {
             bool check = true;
             if (!isTargetting)
             {
                 check = false;
             }
             else if (AtkTargetObj == null)
             {
                 check = false;
             }
             else if (AtkTargetObj.Equals(AStarTargetObj))
             {
                 check = false;
             }
             if (check)
             {
                 myChampBehav.transform.DOLookAt(AtkTargetObj.transform.position, 0);
                 if (AtkTargetObj.tag.Equals("Minion"))
                 {
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     MinionBehavior behav    = AtkTargetObj.GetComponent <MinionBehavior>();
                     AudioSource    minAudio = behav.transform.GetChild(behav.transform.childCount - 1).GetComponent <AudioSource>();
                     if (behav != null)
                     {
                         int viewID = behav.GetComponent <PhotonView>().viewID;
                         myChampBehav.HitRPC(viewID);
                         ChampionSound.instance.IamAttackedSound(minAudio, champname);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage, "AD", myChampBehav.gameObject))
                         {
                             // 미니언쳤는데 죽었으면 cs, 골드 경험치 올려라
                             myChampionData.Kill_CS_Gold_Exp(AtkTargetObj.name, 1, AtkTargetObj.transform.position);
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
                 //else if (AtkTargetObj.tag.Equals("Player"))
                 else if (AtkTargetObj.layer.Equals(LayerMask.NameToLayer("Champion")))
                 {//이 태그대로 할건지 바뀌는지는 모르겠음. 우선 챔피언 공격임.
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     ChampionBehavior behav      = AtkTargetObj.GetComponent <ChampionBehavior>();
                     AudioSource      champaudio = behav.gameObject.GetComponent <AudioSource>();
                     if (behav != null)
                     {
                         int viewID = behav.GetComponent <PhotonView>().viewID;
                         myChampBehav.HitRPC(viewID);
                         ChampionSound.instance.IamAttackedSound(champaudio, champname);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage, "AD", myChampBehav.gameObject, myChampBehav.name))
                         {
                             // 유저쳤는데 죽었으면 kill 골드 경험치 올려라
                             myChampionData.Kill_CS_Gold_Exp(AtkTargetObj.name, 0, AtkTargetObj.transform.position);
                             sysmsg.sendKillmsg(myChampionData.ChampionName, behav.GetComponent <ChampionData>().ChampionName, myChampBehav.Team);
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
                 else if (AtkTargetObj.tag.Equals("Tower"))
                 {
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     TowerBehaviour behav      = AtkTargetObj.GetComponent <TowerBehaviour>();
                     AudioSource    towerAudio = behav.GetComponent <AudioSource>();
                     if (behav != null)
                     {
                         string key     = "";
                         char[] keyChar = behav.gameObject.name.ToCharArray();
                         for (int i = 13; i < 16; ++i)
                         {
                             key += keyChar[i];
                         }
                         myChampBehav.HitRPC(key);
                         ChampionSound.instance.IamAttackedSound(towerAudio, champname);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage))
                         {
                             // 타워쳤는데 죽으면 cs 골드 경험치 올려라
                             myChampionData.Kill_CS_Gold_Exp(AtkTargetObj.name, 2, AtkTargetObj.transform.position);
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
                 else if (AtkTargetObj.tag.Equals("Suppressor"))
                 {
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     SuppressorBehaviour behav = AtkTargetObj.GetComponent <SuppressorBehaviour>();
                     if (behav != null)
                     {
                         string key     = "";
                         char[] keyChar = behav.gameObject.name.ToCharArray();
                         for (int i = 11; i < 14; ++i)
                         {
                             key += keyChar[i];
                         }
                         myChampBehav.HitRPC(key);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage))
                         {
                             // 억제기쳤는데 죽으면 cs 골드 경험치 올려라
                             myChampionData.Kill_CS_Gold_Exp(AtkTargetObj.name, 2, AtkTargetObj.transform.position);
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
                 else if (AtkTargetObj.tag.Equals("Nexus"))
                 {
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     SuppressorBehaviour behav = AtkTargetObj.GetComponent <SuppressorBehaviour>();
                     if (behav != null)
                     {
                         string key     = "";
                         char[] keyChar = behav.gameObject.name.ToCharArray();
                         key += keyChar[6];
                         myChampBehav.HitRPC(key);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage))
                         {
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
                 else if (AtkTargetObj.layer.Equals(LayerMask.NameToLayer("Monster")))
                 {
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     MonsterBehaviour behav = AtkTargetObj.GetComponent <MonsterBehaviour>();
                     if (behav != null)
                     {
                         int viewID = behav.GetComponent <PhotonView>().viewID;
                         myChampBehav.HitRPC(viewID);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage, "AD", myChamp))
                         {
                             // 죽었으면 cs올려라
                             //myChampionData.Kill_CS_Gold_Exp(AtkTargetObj.name, 3, AtkTargetObj.transform.position);
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
             }
         }
         float AS = myChampionData.mystat.Attack_Speed * (1 + (myChampionData.totalstat.UP_AttackSpeed * (myChampionData.totalstat.Level - 1) + (myChampionData.totalstat.Attack_Speed - myChampionData.mystat.Attack_Speed)) / 100);
         atkDelayTime = 1f / AS;
         yield return(new WaitForSeconds(atkDelayTime));
     }
 }
示例#8
0
    IEnumerator AtkMotion()
    {
        while (true)
        {
            if (!isAtkPause)
            {
                bool check = true;
                if (nowTarget == null)
                {
                    check = false;
                }
                else if (!nowTarget.activeInHierarchy)
                {
                    check = false;
                }

                if (check)
                {
                    if (Anim.GetBool("walking"))
                    {
                        Anim.SetBool("walking", false);
                    }
                    Anim.SetTrigger("attack");
                    Vector3 v = nowTarget.transform.position;
                    v.y = 0;
                    myMinion.transform.DOLookAt(v, 1);
                    if (nowTarget.tag.Equals("Minion"))
                    {
                        if (myMinion.name.Contains("Melee"))
                        {
                            MinionBehavior behav = nowTarget.GetComponent <MinionBehavior>();

                            if (behav != null)
                            {
                                int viewID = behav.GetComponent <PhotonView>().viewID;
                                myBehav.HitRPC(viewID);
                                if (behav.HitMe(myBehav.stat.Attack_Damage))
                                {
                                    enemiesList.Remove(nowTarget);
                                }
                            }
                        }
                        else if (myMinion.name.Contains("Magician"))
                        {
                            float moveTime = 0.4f;
                            myBehav.ArrowRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                        else if (myMinion.name.Contains("Siege"))
                        {
                            float moveTime = 0.4f;
                            myBehav.CannonballRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                    }
                    else if (nowTarget.layer.Equals(LayerMask.NameToLayer("Champion")))
                    {
                        if (myMinion.name.Contains("Melee"))
                        {
                            ChampionBehavior behav = nowTarget.GetComponent <ChampionBehavior>();

                            if (behav != null)
                            {
                                int viewID = behav.GetComponent <PhotonView>().viewID;
                                myBehav.HitRPC(viewID);
                                if (behav.HitMe(myBehav.stat.Attack_Damage, "AD", myMinion, myMinion.name))
                                {
                                    sysmsg.sendKillmsg("minion", behav.GetComponent <ChampionData>().ChampionName, myBehav.team.ToString());
                                    enemiesList.Remove(nowTarget);
                                }
                            }
                        }
                        else if (myMinion.name.Contains("Magician"))
                        {
                            float moveTime = 0.4f;
                            myBehav.ArrowRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                        else if (myMinion.name.Contains("Siege"))
                        {
                            float moveTime = 0.4f;
                            myBehav.CannonballRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                    }
                    else if (nowTarget.tag.Equals("Tower"))
                    {
                        if (myMinion.name.Contains("Melee"))
                        {
                            TowerBehaviour behav = nowTarget.GetComponent <TowerBehaviour>();

                            if (behav != null)
                            {
                                string key     = "";
                                char[] keyChar = behav.gameObject.name.ToCharArray();
                                for (int i = 13; i < 16; ++i)
                                {
                                    key += keyChar[i];
                                }
                                myBehav.HitRPC(key);
                                if (behav.HitMe(myBehav.stat.Attack_Damage))
                                {
                                    if (enemyColor.Equals("Red"))
                                    {
                                        inGameManager.blueTeamPlayer[0].GetComponent <PhotonView>().RPC("GlobalGold", PhotonTargets.All, "blue", 100);
                                    }
                                    else
                                    {
                                        inGameManager.redTeamPlayer[0].GetComponent <PhotonView>().RPC("GlobalGold", PhotonTargets.All, "red", 100);
                                    }
                                    enemiesList.Remove(nowTarget);
                                }
                            }
                        }
                        else if (myMinion.name.Contains("Magician"))
                        {
                            float moveTime = 0.4f;
                            myBehav.ArrowRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                        else if (myMinion.name.Contains("Siege"))
                        {
                            float moveTime = 0.4f;
                            myBehav.CannonballRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                    }
                    else if (nowTarget.tag.Equals("Suppressor") || nowTarget.tag.Equals("Nexus"))
                    {
                        if (myMinion.name.Contains("Melee"))
                        {
                            SuppressorBehaviour behav = nowTarget.GetComponent <SuppressorBehaviour>();

                            if (behav != null)
                            {
                                string key     = "";
                                char[] keyChar = behav.gameObject.name.ToCharArray();
                                if (nowTarget.tag.Equals("Nexus"))
                                {
                                    key += keyChar[6];
                                }
                                else
                                {
                                    for (int i = 11; i < 14; ++i)
                                    {
                                        key += keyChar[i];
                                    }
                                }
                                myBehav.HitRPC(key);
                                if (behav.HitMe(myBehav.stat.Attack_Damage))
                                {
                                    enemiesList.Remove(nowTarget);
                                }
                            }
                        }
                        else if (myMinion.name.Contains("Magician"))
                        {
                            float moveTime = 0.4f;
                            myBehav.ArrowRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                        else if (myMinion.name.Contains("Siege"))
                        {
                            float moveTime = 0.4f;
                            myBehav.CannonballRPC(nowTarget.transform.position, moveTime);
                            Invoke("ProjectileAtk", moveTime);
                        }
                    }
                }
            }
            atkDelayTime = 1f;
            yield return(new WaitForSeconds(1));
        }
    }
示例#9
0
    /// <summary>
    /// W 스킬 함수
    /// </summary>
    public override void W()
    {
        GameObject enemyObj    = wArguObj;
        Vector3    enemyVector = wArguVec;

        OnMove();
        HitEffectRPC("Alistar", "W");
        GameObject obj = GetSkillInThePool("W");

        obj.transform.position = transform.position;
        obj.SetActive(true);

        // 공격하는 대상에 따라 공격 처리를 한다.
        if (enemyObj.tag.Equals("Minion"))
        {
            MinionBehavior minBehav = enemyObj.GetComponent <MinionBehavior>();

            // 적인지 확인
            if (!enemyObj.gameObject.name.Contains(TheChampionBehaviour.team))
            {
                MinionAtk  minAtk       = minBehav.minAtk;
                Vector3    directionVec = (enemyObj.transform.position - enemyVector).normalized;
                Vector3    maxVec       = enemyObj.transform.position + (directionVec * 10);;
                RaycastHit hit;

                if (Physics.Raycast(minAtk.transform.position, directionVec, out hit, 12, 1 << LayerMask.NameToLayer("WallCollider")))
                {
                    float dist = Vector3.Distance(hit.point, enemyObj.transform.position);
                    maxVec = enemyObj.transform.position + (directionVec * (dist - 1f));
                }

                //밀친 후 공격당한 대상의 HitMe 함수를 호출
                maxVec.y = 0;
                minAtk.PushMe(maxVec, 0.5f);
                minAtk.PauseAtk(1f, true);
                float damage = skillData.wDamage[TheChampionData.skill_W - 1] + Acalculate(skillData.wAstat, skillData.wAvalue);

                if (minBehav != null)
                {
                    int viewID = minBehav.GetComponent <PhotonView>().viewID;
                    HitRPC(viewID, damage, "AP", "Push");
                    minBehav.HitMe(damage, "AP", gameObject);
                }
            }
        }
        else if (enemyObj.layer.Equals(LayerMask.NameToLayer("Champion")))
        {
            ChampionBehavior champBehav = enemyObj.GetComponent <ChampionBehavior>();

            // 적인지 확인
            if (champBehav.team != TheChampionBehaviour.team)
            {
                ChampionAtk champAtk     = champBehav.myChampAtk;
                Vector3     directionVec = (enemyObj.transform.position - enemyVector).normalized;
                Vector3     maxVec       = enemyObj.transform.position + (directionVec * 5);;
                RaycastHit  hit;

                if (Physics.Raycast(champAtk.transform.position, directionVec, out hit, 6, 1 << LayerMask.NameToLayer("WallCollider")))
                {
                    float dis = Vector3.Distance(hit.point, enemyObj.transform.position);
                    maxVec = enemyObj.transform.position + (directionVec * (dis - 1f));
                }

                //밀친 후 공격당한 대상의 HitMe 함수를 호출
                maxVec.y = 0.5f;
                champAtk.PushMe(maxVec, 0.5f);
                champAtk.PauseAtk(1f, true);
                float damage = skillData.wDamage[TheChampionData.skill_W - 1] + Acalculate(skillData.wAstat, skillData.wAvalue);

                if (champBehav != null)
                {
                    int viewID = champBehav.GetComponent <PhotonView>().viewID;

                    HitRPC(viewID, damage, "AP", "Push");
                    champBehav.HitMe(damage, "AP", gameObject, gameObject.name);
                }
            }
        }
        else if (enemyObj.layer.Equals(LayerMask.NameToLayer("Monster")))
        {
            MonsterBehaviour monBehav     = enemyObj.GetComponent <MonsterBehaviour>();
            MonsterAtk       monAtk       = monBehav.monAtk;
            Vector3          directionVec = (enemyObj.transform.position - enemyVector).normalized;
            Vector3          maxVec       = enemyObj.transform.position + (directionVec * 5);;
            RaycastHit       hit;

            if (Physics.Raycast(monAtk.transform.position, directionVec, out hit, 6, 1 << LayerMask.NameToLayer("WallCollider")))
            {
                float dist = Vector3.Distance(hit.point, enemyObj.transform.position);
                maxVec = enemyObj.transform.position + (directionVec * (dist - 1f));
            }

            //밀친 후 공격당한 대상의 HitMe 함수를 호출
            maxVec.y = 0;
            monAtk.PushMe(maxVec, 0.5f);
            monAtk.PauseAtk(1f, true);
            float damage = skillData.wDamage[TheChampionData.skill_W - 1] + Acalculate(skillData.wAstat, skillData.wAvalue);

            if (monBehav != null)
            {
                int viewID = monBehav.GetComponent <PhotonView>().viewID;
                HitRPC(viewID, damage, "AP", "Push");
                monBehav.HitMe(damage, "AP", gameObject);
            }
        }

        // 스킬 선택을 해제함
        skillSelect = SkillSelect.none;
    }