Exemple #1
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;
    }
    /// <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;
    }