Exemplo n.º 1
0
    public override void EndState(Vector3 _pos)
    {
        base.EndState(_pos);

        if (cNetworkIdentity.isHost)
        {
            SkillManager.instance.Skilling(SkillManager.JUDGE_LEAP, this.gameObject, transform, targetTr.position, aiCon.aiInfo.damage);
            isAction  = false;
            isLanding = false;
            LookatTarget(targetTr.position);
            networkAITransmitor.EndFullAction();
            aiCon.EndActionCheckState(AIController.AIState.LEAP);
        }
        else
        {
            SkillManager.instance.Skilling(SkillManager.JUDGE_LEAP, this.gameObject, transform, _pos, aiCon.aiInfo.damage);
            this.enabled = false;
            isAction     = false;
            Debug.Log("완전공격끝 처리");
            CAIPacket _aiPacket = networkAISyncor.GetSyncInfo();
            _aiPacket.DeFlagAction();
            networkAISyncor.CheckSyncEnd(_aiPacket);
            networkAISyncor.EndFullAction();
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 오프메시링크 관련 상태 : 벽 오르기(Wall), 뛰어내리기(Cliff)
    /// **서버에 어떻게 주지?
    /// </summary>
    public void OffLinkStateCheck()
    {
        if (offLink == null && nav.isOnOffMeshLink)
        {
            CAIPacket _aiPacket = networkAITransmitor.GetAIPacket();

            offLink = nav.currentOffMeshLinkData.offMeshLink;

            if (offLink.CompareTag("Wall"))
            {
                state = AIState.CLIMB;
                networkAITransmitor.SetCurAIAction(AiAction.Climb);
            }
            else if (offLink.CompareTag("Cliff"))
            {
                state = AIState.LAND;
                networkAITransmitor.SetCurAIAction(AiAction.Land);
                _aiPacket.SetAIAngleR(transform.rotation.eulerAngles.y);
            }

            _aiPacket.SetAIAction(networkAITransmitor.GetCurAIAction());
            _aiPacket.SetAIPosition(transform.position);

            AIChangeState(state);
        }

        // **여기서 전송
    }
Exemplo n.º 3
0
    /// <summary>
    /// 1. 벽 다 오르면 위치 이동시키기
    /// 2. 상태 돌려주기
    /// 3. 바로 움직일 수 있게 해주기
    /// </summary>
    /// <param name="_pos"></param>
    public override void EndState(Vector3 _pos)
    {
        base.EndState(_pos);

        Debug.Log("클라이밍 끝");

        // 1.
        transform.position = offLink.endTransform.position;

        // 2.
        isAction = false;
        isClimb  = false;

        offLink.activated    = true;
        offLink.costOverride = oldLinkCost;
        offLink = null;

        aiCon.offLink = null;

        if (cNetworkIdentity.isHost)
        {
            networkAITransmitor.EndFullAction();
            aiCon.EndActionCheckState(AIController.AIState.CLIMB);
        }
        else
        {
            Debug.Log("뛰어내리기 끝 처리");
            CAIPacket _aiPacket = networkAISyncor.GetSyncInfo();
            _aiPacket.DeFlagAction();
            networkAISyncor.CheckSyncEnd(_aiPacket);
            networkAISyncor.EndFullAction();
        }
    }
Exemplo n.º 4
0
    private void FixedUpdate()
    {
        if (cNetworkIdentity.isHost)
        {
            tick++;

            if (tick >= aiTickCount * SkillManager.instance.dictSkill[aiCon.aiInfo.skill.skillIds[activeSkillNum]].reboundTime * 16)
            {
                tick = 0;

                isSkill  = false;
                isAction = false;

                CAIPacket _aiPacket = networkAITransmitor.GetAIPacket();
                _aiPacket.SetAIAction(Global.AiAction.AttackEnd);
                networkAITransmitor.EndFullAction();
                aiCon.EndActionCheckState(AIController.AIState.ATTACK);
            }
        }
        else
        {
            CAIPacket _aiPacket = networkAISyncor.GetSyncInfo();

            if (_aiPacket == null)
            {
                return;
            }
            if (_aiPacket.m_Action == Global.AiAction.AttackEnd)
            {
                //attack 끝처리
                isAction = false;
                _aiPacket.DeFlagAction();
                networkAISyncor.CheckSyncEnd(_aiPacket);
                networkAISyncor.EndFullAction();
                this.enabled = false;
            }
            else if (_aiPacket.m_Action == Global.AiAction.KnockBack)
            {
                //공격 캔슬 후 넉백처리
                Vector3          _knockBackPos   = _aiPacket.m_TargetPos;
                AIKnockBackState _knockbackState = GetComponent <AIKnockBackState>();
                _knockbackState.GuestSkillAction(0, _knockBackPos);
                _aiPacket.DeFlagAngleV();
                _aiPacket.DeFlagAiPos();
                _aiPacket.DeFlagAction();
                networkAISyncor.CheckSyncEnd(_aiPacket);
                this.enabled = false;
            }
        }
    }
Exemplo n.º 5
0
    public void KnockbackSetting(Vector3 pos)
    {
        if (cNetworkIdentity.isHost)
        {
            if (state == AIState.KNOCKBACK)
            {
                return;
            }

            CAIPacket _aiPacket = networkAITransmitor.GetAIPacket();

            networkAITransmitor.SetCurAIAction(AiAction.KnockBack);
            _aiPacket.SetAIAction(networkAITransmitor.GetCurAIAction());
            _aiPacket.SetAIPosition(transform.position);
            // _aiPacket.SetAIAngleR(transform.rotation.eulerAngles.y);
            _aiPacket.SetAIAngleV(pos);

            state = AIState.KNOCKBACK;
            AIChangeState(state);
        }
        else
        {
            while (true)
            {
                try
                {
                    CAIPacket _aiPacket = networkAISyncor.GetSyncInfo();
                    if (_aiPacket.m_Action == Global.AiAction.AttackEnd)
                    {
                        _aiPacket.DeFlagAction();
                    }
                    else if (_aiPacket.m_Action == AiAction.KnockBack)
                    {
                        _aiPacket.ForceDeFlagAll();
                        networkAISyncor.CheckSyncEnd(_aiPacket);
                    }
                    else
                    {
                        break;
                    }
                }
                catch
                {
                    break;
                }
            }
        }
    }
Exemplo n.º 6
0
    public override IEnumerator SkillRebound(float _time)
    {
        yield return(new WaitForSeconds(_time));

        if (cNetworkIdentity.isHost)
        {
            isSkill  = false;
            isAction = false;
            networkAITransmitor.EndFullAction();
            aiCon.EndActionCheckState(AIController.AIState.SPIT);
        }
        else
        {
            Debug.Log("완전공격끝 처리");
            CAIPacket _aiPacket = networkAISyncor.GetSyncInfo();
            _aiPacket.DeFlagAction();
            networkAISyncor.CheckSyncEnd(_aiPacket);
            networkAISyncor.EndFullAction();
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// 1. 벽 다 오르면 위치 이동시키기
    /// 2. 상태 돌려주기
    /// 3. 바로 움직일 수 있게 해주기
    /// </summary>
    /// <param name="_pos"></param>
    public override void EndState(Vector3 _pos)
    {
        base.EndState(_pos);

        isAction = false;

        if (cNetworkIdentity.isHost)
        {
            nav.isStopped = false;
            nav.CompleteOffMeshLink();
            offLink.activated    = true;
            offLink.costOverride = -1;
            offLink       = null;
            aiCon.offLink = null;
            networkAITransmitor.EndFullAction();
            aiCon.EndActionCheckState(AIController.AIState.LAND);
        }
        else
        {
            //NavMeshHit hit;
            //nav.SamplePathPosition(groundLayer, 2f, out hit);
            //nav.nextPosition = hit.position;
            Debug.Log(offLink.endTransform.position);
            nav.enabled      = true;
            nav.nextPosition = offLink.endTransform.position;
            //nav.CompleteOffMeshLink();
            Debug.Log("뛰어내리기 끝 처리");
            offLink.activated    = true;
            offLink.costOverride = -1;
            offLink       = null;
            aiCon.offLink = null;
            CAIPacket _aiPacket = networkAISyncor.GetSyncInfo();
            _aiPacket.DeFlagAction();
            networkAISyncor.CheckSyncEnd(_aiPacket);
            networkAISyncor.EndFullAction();
        }
    }
Exemplo n.º 8
0
    void AttackTransmitor()
    {
        CAIPacket _aiPacket = networkAITransmitor.GetAIPacket();

        switch (aiInfo.skill.skillIds[skillProcess.skillInfo.usingSkillNum])
        {
        case SkillManager.LEAP_ATTACK:
            state    = AIState.LEAP;
            targetTr = aiAggro.getSecondTarget();
            networkAITransmitor.SetCurAIAction(AiAction.Skill_Jump);
            _aiPacket.SetAIAngleV(targetTr.position);
            break;

        case SkillManager.RUSH_ATTACK:
            state = AIState.RUSH;
            networkAITransmitor.SetCurAIAction(AiAction.Skill_Rush);
            break;

        case SkillManager.SLOW_SPIT:
        case SkillManager.SLOW_SPIT2:
        case SkillManager.POSION_SPIT:
            state = AIState.SPIT;
            networkAITransmitor.SetCurAIAction(AiAction.Skill_Spit);
            _aiPacket.SetAIAngleV(targetTr.position);
            break;

        default:
            state = AIState.ATTACK;
            networkAITransmitor.SetCurAIAction(AiAction.AttackStart);
            break;
        }
        _aiPacket.SetAIAction(networkAITransmitor.GetCurAIAction());
        _aiPacket.SetAIPosition(transform.position);
        _aiPacket.SetAIAngleR(transform.rotation.eulerAngles.y);

        // networkAITransmitor.StartFullAction();
    }
Exemplo n.º 9
0
    /// <summary>
    /// 애니메이션 이벤트
    /// 1. 위치 이동시키기
    /// 2. 상태 돌려주기
    /// 3. 바로 움직일 수 있게 해주기
    /// </summary>
    /// <param name="_pos"></param>
    public override void EndState(Vector3 _pos)
    {
        base.EndState(_pos);

        Debug.Log("돌진 끝");

        // 2.
        NavMeshHit hit;

        NavMesh.SamplePosition(transform.position, out hit, 2f, NavMesh.AllAreas);
        nav.nextPosition = hit.position;
        // 3.
        ConditionRegulate(AIController.AIState.RUSH, false);

        // 판정오브젝트 제자리로 돌리기 (JudgingSkill 자체처리)
        aiCon.judgeObj = null;

        if (cNetworkIdentity.isHost)
        {
            nav.SetDestination(targetTr.position);

            isSkill  = false;
            isAction = false;
            networkAITransmitor.EndFullAction();
            aiCon.EndActionCheckState(AIController.AIState.RUSH);
        }
        else
        {
            this.enabled = false;
            Debug.Log("완전공격끝 처리");
            CAIPacket _aiPacket = networkAISyncor.GetSyncInfo();
            _aiPacket.DeFlagAction();
            networkAISyncor.CheckSyncEnd(_aiPacket);
            networkAISyncor.EndFullAction();
        }
    }
Exemplo n.º 10
0
    public void FullActionSyncor(CAIPacket _aiPacket)
    {
        transform.position = _aiPacket.m_AIPos;
        transform.rotation = Quaternion.Euler(new Vector3(0, _aiPacket.m_AIRotY, 0));

        // Debug.Log(_aiPacket.m_Action);
        switch (_aiPacket.m_Action)
        {
        case AiAction.AttackStart:
            aiAnim.AIAnimationCheck(AIState.ATTACK);
            baseState.dictStateAction[AIState.ATTACK].GuestSkillAction(aiInfo.skill.skillIds[0], transform.position);
            _aiPacket.DeFlagAngleR();
            _aiPacket.DeFlagAiPos();
            _aiPacket.DeFlagAction();
            networkAISyncor.CheckSyncEnd(_aiPacket);
            break;

        case AiAction.Skill_Spit:
            Vector3 _spitPos = _aiPacket.m_TargetPos;
            aiAnim.AIAnimationCheck(AIState.SPIT);
            baseState.dictStateAction[AIState.SPIT].GuestSkillAction(aiInfo.skill.skillIds[1], _spitPos);
            _aiPacket.DeFlagAngleV();
            _aiPacket.DeFlagAiPos();
            _aiPacket.DeFlagAngleR();
            break;

        case AiAction.Skill_Jump:
            Vector3 _LeapPos = _aiPacket.m_TargetPos;
            aiAnim.AIAnimationCheck(AIState.LEAP);
            baseState.dictStateAction[AIState.LEAP].GuestSkillAction(aiInfo.skill.skillIds[1], _LeapPos);
            _aiPacket.DeFlagAngleV();
            _aiPacket.DeFlagAiPos();
            _aiPacket.DeFlagAngleR();
            break;

        case AiAction.Skill_Rush:
            aiAnim.AIAnimationCheck(AIState.RUSH);
            Debug.Log(aiInfo.skill.skillIds[1]);
            baseState.dictStateAction[AIState.RUSH].GuestSkillAction(aiInfo.skill.skillIds[1], transform.position);
            _aiPacket.DeFlagAngleR();
            _aiPacket.DeFlagAiPos();
            break;

        case AiAction.KnockBack:
            Vector3 _knockBackPos = _aiPacket.m_TargetPos;
            baseState.dictStateAction[AIState.KNOCKBACK].GuestSkillAction(0, _knockBackPos);
            _aiPacket.DeFlagAngleV();
            _aiPacket.DeFlagAiPos();
            _aiPacket.DeFlagAction();
            networkAISyncor.CheckSyncEnd(_aiPacket);
            break;

        case AiAction.Climb:
            aiAnim.AIAnimationCheck(AIState.CLIMB);
            baseState.dictStateAction[AIState.CLIMB].GuestAction();
            _aiPacket.DeFlagAiPos();
            break;

        case AiAction.Land:
            aiAnim.AIAnimationCheck(AIState.LAND);
            baseState.dictStateAction[AIState.LAND].GuestAction();
            _aiPacket.DeFlagAiPos();
            _aiPacket.DeFlagAngleR();
            break;
        }
        // Debug.Log("공격 명령시작");
    }