Ejemplo n.º 1
0
    public void Push(float power)
    {
        if (NowSkillType != BuffType.Knockback)
        {
            return;
        }
        //{
        //Push(PushPower);
        //}

        Vector3 EndPos = parent.cachedTransform.position + ((-parent.cachedTransform.forward) * power);

        NavMeshHit navHit;

        if (NavMesh.SamplePosition(EndPos, out navHit, Vector3.Distance(EndPos, parent.cachedTransform.position), 9))
        {
            ArrivalPos = navHit.position;
            Debug.Log("StunState StartPos:" + parent.cachedTransform.position + " EndPos:" + EndPos + " AdjustPos:" + ArrivalPos + " power: " + power);
        }
        else
        {
            ArrivalPos = parent.cachedTransform.position;
            Debug.LogError("StunState Faild Position StartPos:" + parent.cachedTransform.position + " EndPos:" + EndPos + " AdjustPos:" + ArrivalPos + " power: " + power);
        }

        //ArrivalPos = EndPos;
        ArrivalLook = ArrivalPos - parent.cachedTransform.position;
        ArrivalLook.Normalize();

        PushSpeed   = power * 3f;
        startedPush = true;
    }
Ejemplo n.º 2
0
    public void PushForDie(float power)
    {
        //Push(eAnimName.Anim_none, -transform.forward, power, parent.Animator.GetAnimLength(eAnimName.Anim_down), UnitState.Dead);

        //< 도착 위치를 먼저 얻는다.
        Vector3 EndPos = parent.cachedTransform.position + ((-parent.cachedTransform.forward) * power);

        //Debug.LogWarning("2JW : 111 " + this.transform.position + " : " + transform.forward + " : " + power + " : " + EndPos);
        //< 해당 위치가 이동 가능한 위치인지 검사한다.
        NavMeshHit navHit;

        if (NavMesh.SamplePosition(EndPos, out navHit, Vector3.Distance(EndPos, parent.cachedTransform.position), 9))
        {
            ArrivalPos = navHit.position;
            Debug.Log("PushForDie StartPos:" + parent.cachedTransform.position + " EndPos:" + EndPos + " AdjustPos:" + ArrivalPos + " power: " + power);
        }
        else
        {
            ArrivalPos = parent.cachedTransform.position;
            Debug.LogError("PushForDie Faild Position StartPos:" + parent.cachedTransform.position + " EndPos:" + EndPos + " AdjustPos:" + ArrivalPos + " power: " + power);
        }

        //ArrivalPos = EndPos;
        ArrivalLook = ArrivalPos - parent.cachedTransform.position;
        ArrivalLook.Normalize();

        PushSpeed = power * 3f;
        //PushSpeed = EndPos.magnitude / (power * 2);
    }
Ejemplo n.º 3
0
    //테스트용 위치로 날리기
    public void Push(float power, Vector3 targetPos)
    {
        if (NowSkillType != BuffType.Knockback)
        {
            return;
        }
        //{
        //Push(PushPower);
        //}

        //Vector3 EndPos = this.transform.position + ((-transform.forward) * power);

        Vector3 EndPos = targetPos;

        NavMeshHit navHit;

        if (NavMesh.SamplePosition(EndPos, out navHit, Vector3.Distance(EndPos, parent.cachedTransform.position), 9))
        {
            EndPos = navHit.position;
        }

        ArrivalPos  = EndPos;
        ArrivalLook = ArrivalPos - parent.cachedTransform.position;
        ArrivalLook.Normalize();

        PushSpeed   = power * 3f;
        startedPush = true;
    }
Ejemplo n.º 4
0
    //< 죽었을때 뒤로 밀려나는 처리
    void PushUpdate()
    {
        //G_GameInfo.GameMode == GAME_MODE.PVP || G_GameInfo.GameMode == GAME_MODE.SPARRING ||
        if ((parent.UnitType == UnitType.Boss || parent.UnitType == UnitType.Unit || parent.NotDeadPush))
        {
            if (!parent.Model.Main.animation.isPlaying)
            {
                parent.ChangeState(UnitState.Dead);
            }
        }
        else
        {
            //< 해당 위치까지 이동시킨다
            if (Vector3.Distance(parent.cachedTransform.position, ArrivalPos) < (PushSpeed * Time.deltaTime))
            {
                if (!parent.Model.Main.animation.isPlaying)
                {
                    parent.ChangeState(UnitState.Dead);
                }
            }
            else
            {
                //올바른 방향으로 계속 조절
                ArrivalLook = ArrivalPos - parent.cachedTransform.position;
                ArrivalLook.Normalize();

                parent.cachedTransform.Translate(ArrivalLook * (PushSpeed * Time.deltaTime), Space.World);
            }
        }
    }
Ejemplo n.º 5
0
    public override void CachedUpdate()
    {
        if (!startedPush)
        {
            return;
        }

        if (Vector3.Distance(parent.cachedTransform.position, ArrivalPos) < (PushSpeed * Time.deltaTime))
        {
        }
        else
        {
            ArrivalLook = ArrivalPos - parent.cachedTransform.position;
            ArrivalLook.Normalize();
            parent.cachedTransform.Translate(ArrivalLook * (PushSpeed * Time.deltaTime), Space.World);
        }
    }