Ejemplo n.º 1
0
 public void ShowInfo(TowerBehaviour tower)
 {
     if (currentTower != null)
     {
         currentTower.GetComponent <Outline>().enabled = false;
         currentTower.ReturnRangeAttack.GetComponent <Outline>().enabled = false;
     }
     currentTower = tower;
     currentTower.GetComponent <Outline>().enabled = true;
     currentTower.ReturnRangeAttack.GetComponent <Outline>().enabled = true;
     gameObject.SetActive(true);
     ResetInfo(tower);
 }
Ejemplo n.º 2
0
    void DetectionRange()
    {
        //Using Overlap Sphere as a detection radius on the target layermask
        //with enemies to detect if there are enemies around the tower
        //this returns an array of game Objects colliders marked as enemies
        Collider[] colliders = Physics.OverlapSphere(owner.transform.position, tower_Params._detectionRadius, layer_mask);

        //Reference to the owner Towerbehaviour script
        var ownerList = owner.targets;

        //Add all elements detected to a reference list in the parent tower object
        foreach (Collider detected in colliders)
        {
            if (!ownerList.Contains(detected.gameObject))
            {
                ownerList.Add(detected.gameObject);
            }
        }

        //If there is a change in the number of gameObjects detected in the
        //array of target colliders versus the list that's in the parent
        //then this means that either a target has been destroy by the current tower or by a neighboring tower
        //remove the destroyed target from the tracking list on the parent towerbehaviour script, if the list only
        //have 1 item left in it
        for (int i = 0; i <= colliders.Length; i++)
        {
            if (colliders.Length != ownerList.Count)
            {
                if (ownerList.Count == 1)
                {
                    owner.GetComponent <TowerBehaviour>().CurrentTarget = null;
                    ownerList.RemoveAt(i);
                }
                else
                {
                    ownerList.RemoveAt(i);
                }
            }
        }
    }
Ejemplo n.º 3
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));
        }
    }
Ejemplo n.º 4
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));
     }
 }