예제 #1
0
    /// <summary>
    /// 와드를 설치하는 함수
    /// </summary>
    private void InstallWard()
    {
        if (isWillAtkAround)
        {
            isWillAtkAround = false;
        }

        if (Vector3.Distance(transform.position, aStarTargetObj.transform.position) < 15f)
        {
            isWarding = false;
            --wardAmount;
            myChampBehav.WardRPC(myChampBehav.team, myChampionData.myStat.Level, aStarTargetObj.transform.position);
            aStarTargetObj.transform.position = transform.position;
            ResetTarget();
        }
    }
예제 #2
0
    private void Update()
    {
        if (atkDelayTime > 0)
        {
            atkDelayTime -= Time.deltaTime;
            if (!isAtkDelayTime)
            {
                isAtkDelayTime = true;
            }
        }
        else
        {
            if (isAtkDelayTime)
            {
                isAtkDelayTime = false;
            }
        }
        if (isWarding)
        {
            if (willAtkAround)
            {
                willAtkAround = false;
            }
            if (Vector3.Distance(transform.position, AStarTargetObj.transform.position) < 15f)
            {
                isWarding = false;
                --wardAmount;
                myChampBehav.WardRPC(myChampBehav.Team, myChampionData.mystat.Level, AStarTargetObj.transform.position);
                AStarTargetObj.transform.position = transform.position;
                ResetTarget();
            }
        }
        if (willAtkAround)
        {
            float      dist = 1000000, nowD;
            GameObject temp = null;
            for (int i = 0; i < enemiesList.Count; ++i)
            {
                if (enemiesList[i].tag.Equals("Tower"))
                {
                    if (!enemiesList[i].GetComponent <TowerBehaviour>().isCanAtkMe)
                    {
                        continue;
                    }
                }
                else if (enemiesList[i].tag.Equals("Suppressor") || enemiesList[i].tag.Equals("Nexus"))
                {
                    if (!enemiesList[i].GetComponent <SuppressorBehaviour>().isCanAtkMe)
                    {
                        continue;
                    }
                }
                else if (enemiesList[i].layer.Equals(LayerMask.NameToLayer("Monster")))
                {
                    MonsterBehaviour m = enemiesList[i].GetComponent <MonsterBehaviour>();
                    if (!m.TheFogEntity.isCanTargeting)
                    {
                        continue;
                    }
                    if (!m.monAtk.isAtking)
                    {
                        continue;
                    }
                }
                nowD = (enemiesList[i].transform.position - myChamp.transform.position).sqrMagnitude;
                if (dist > nowD)
                {
                    dist = nowD;
                    temp = enemiesList[i];
                }
                if (temp != null)
                {
                    AtkTargetObj = temp;
                    isTargetting = true;
                }
            }
        }
        if (AtkTargetObj != null)
        {
            if (isTargetting && AtkTargetObj.activeInHierarchy)
            {
                if (TheAIDest.target != AtkTargetObj.transform)
                {
                    TheAIDest.target = AtkTargetObj.transform;
                }

                tempVec1   = AtkTargetObj.transform.position;
                tempVec2   = myChamp.transform.position;
                tempVec1.y = 0;
                tempVec2.y = 0;
                float atkRevision = 0;
                if (AtkTargetObj.tag.Equals("Tower") && AtkRange < 5)//타워 크기 보정
                {
                    atkRevision = 1f;
                }
                else if (AtkTargetObj.tag.Equals("Suppressor") && AtkRange < 5)//억제기 반지름 보정
                {
                    atkRevision = 2.5f;
                }
                else if (AtkTargetObj.tag.Equals("Nexus") && AtkRange < 5)
                {
                    atkRevision = 7f;
                }

                if (Vector3.Distance(tempVec1, tempVec2) > AtkRange + atkRevision)
                {//머니까 겁내 뛰어가자
                    if (!TheAIPath.canMove)
                    {
                        TheAIPath.canMove   = true;
                        TheAIPath.canSearch = true;
                        myChampionAnimation.AttackAnimation(false);
                    }
                    if (AtkCoroutine != null)
                    {
                        myChampionAnimation.AttackAnimation(false);
                        StopCoroutine(AtkCoroutine);
                        AtkCoroutine = null;
                    }
                }
                else
                {//패자 계속 갈구자
                    if (!isAtkDelayTime)
                    {
                        if (TheAIPath.canMove)
                        {
                            TheAIPath.canMove   = false;
                            TheAIPath.canSearch = false;

                            myChampionAnimation.AttackAnimation(true);
                        }
                        if (AtkCoroutine == null)
                        {
                            AtkCoroutine = StartCoroutine(AtkMotion());
                        }
                    }
                }
            }
            else
            {
                ResetTarget();
            }
        }
        else
        {
            ResetTarget();
        }

        if (wardAmount < 2)
        {
            wardMadeCooldown -= Time.deltaTime;
            if (wardMadeCooldown <= 0f)
            {
                ++wardAmount;
                wardMadeCooldown = Mathf.Round(wardMadeMaxTime - ((wardMadeTermTime * ((float)(myChampionData.mystat.Level - 1))) / 17f));
            }
        }
    }