Exemplo n.º 1
0
 public void SkillEnd()
 {
     for (int i = 0; i < trail.Length; i++)
     {
         trail[i].SetActive(false);
     }
     eWarriorState = EWarriorState.idle;
 }
Exemplo n.º 2
0
 public void ComboEnd()
 {
     isAttack = false;
     am.SetBool("isAttack", isAttack);
     eWarriorState = EWarriorState.idle;
     for (int i = 0; i < trail.Length; i++)
     {
         trail[i].SetActive(false);
     }
 }
Exemplo n.º 3
0
 public void BuffOnOff()
 {
     if (isBuff)
     {
         return;
     }
     eWarriorState = EWarriorState.skill1;
     isBuff        = true;
     am.SetBool("isMove", false);
     am.SetTrigger("Skill1");
     StartCoroutine(BuffSkill());
 }
Exemplo n.º 4
0
 public void ComboAttack()
 {
     if (Input.GetButtonDown("BasicAttack"))
     {
         isAttack = true;
         am.SetBool("isAttack", isAttack);
         eWarriorState = EWarriorState.attack2;
         for (int i = 0; i < trail.Length; i++)
         {
             trail[i].SetActive(true);
         }
     }
 }
Exemplo n.º 5
0
 public void AttackAnimEnd()
 {
     if (!isAttack)
     {
         am.SetBool("isAttack", isAttack);
         eWarriorState = EWarriorState.idle;
         for (int i = 0; i < trail.Length; i++)
         {
             trail[i].SetActive(false);
         }
     }
     else
     {
         return;
     }
 }
Exemplo n.º 6
0
    public void Skill()
    {
        if (Input.GetButtonDown("Skill1"))
        {
            BuffOnOff();
        }

        if (Input.GetButtonDown("Skill2"))
        {
            eWarriorState = EWarriorState.skill2;
            for (int i = 0; i < trail.Length; i++)
            {
                trail[i].SetActive(true);
            }
            am.SetBool("isMove", false);
            am.SetTrigger("Skill2");
        }
    }
Exemplo n.º 7
0
    /////////////////////////////////////////////////////////////////////////////
    /// Function:               RunMovingState
    /////////////////////////////////////////////////////////////////////////////
    private void RunMovingState()
    {
        // Enable the moving animation if it's not on.
        if (false == m_anAnimator.GetBool(AnimatorValues.ANIMATOR_IS_MOVING))
        {
            m_anAnimator.SetBool(AnimatorValues.ANIMATOR_IS_MOVING, true);
        }

        if (true == m_anAnimator.GetBool(AnimatorValues.ANIMATOR_ENEMY_SEEN))
        {
            m_anAnimator.SetBool(AnimatorValues.ANIMATOR_ENEMY_SEEN, false);
        }

        m_fOldTime = m_fElapsedTime + 0.01f;

        if (m_fElapsedTime > m_fCheckTime)
        {
            m_fCheckTime = m_fElapsedTime + 1;
            SetTarget();
        }

        if (m_liPath != null)
        {
            if (true == m_bReachedTarget)
            {
                // We reached our destination, switch to idle and clear the target
                //  vector.
                m_bReachedTarget = false;
                m_eState         = EWarriorState.WARRIOR_IDLE;
                m_v3Target       = Vector3.zero;
                return;
            }

            if (true == m_bReachedNode)
            {
                m_bReachedNode = false;
                m_v3CurrNode   = m_liPath[m_iNodeIndex];
            }
            else
            {
                GoTo();
            }
        }
    }
Exemplo n.º 8
0
 private void OnTriggerEnter(Collider other)
 {
     if (eWarriorState == EWarriorState.death)
     {
         return;
     }
     if (other.CompareTag("EnemyWeapon"))
     {
         hm.PlayerHpUpdate();
         StartCoroutine(DamagedEffect());
         if (hp <= 0)
         {
             Debug.Log("죽음");
             eWarriorState = EWarriorState.death;
             am.SetTrigger("Death");
             PlayerDeath();
         }
     }
 }
Exemplo n.º 9
0
    // 회피기 Complete
    public IEnumerator AvoidanceTime()
    {
        dashTrail.SetActive(true);
        am.SetTrigger("Dash");
        avoidanceDir  = moveDir;
        eWarriorState = EWarriorState.dash;
        yield return(new WaitForSeconds(am.GetCurrentAnimatorStateInfo(0).length));

        dashTrail.SetActive(false);
        if (moveDir != Vector3.zero)
        {
            am.SetBool("isMove", true);
            eWarriorState = EWarriorState.move;
        }
        else
        {
            am.SetBool("isMove", false);
            eWarriorState = EWarriorState.idle;
        }
    }
Exemplo n.º 10
0
    void Update()
    {
        SetDir();
        switch (eWarriorState)
        {
        case EWarriorState.idle:
            if (moveDir != Vector3.zero)
            {
                am.SetBool("isMove", true);
                eWarriorState = EWarriorState.move;
            }

            if (Input.GetButtonDown("Dash"))
            {
                StartCoroutine(AvoidanceTime());
            }

            BasicAttack();
            Skill();
            break;

        case EWarriorState.move:
            Movement();
            PlayerRotate();
            Skill();
            if (moveDir.Equals(Vector3.zero))
            {
                am.SetBool("isMove", false);
                eWarriorState = EWarriorState.idle;
            }

            if (Input.GetButtonDown("Dash"))
            {
                StartCoroutine(AvoidanceTime());
            }

            BasicAttack();

            break;

        case EWarriorState.dash:
            Avoidance();
            break;

        case EWarriorState.attack:
            EnemyChasing();
            //LockOn();
            ComboAttack();
            break;

        case EWarriorState.attack2:
            EnemyChasing();
            LockOn();
            ComboAttack();
            break;

        case EWarriorState.attack3:
            break;

        case EWarriorState.skill1:
            break;

        case EWarriorState.skill2:
            LockOn();
            break;

        case EWarriorState.damaged:
            break;

        case EWarriorState.death:
            break;

        default:
            break;
        }
    }
Exemplo n.º 11
0
    /////////////////////////////////////////////////////////////////////////////
    /// Function:               CheckForTransitions
    /////////////////////////////////////////////////////////////////////////////
    private void CheckForTransitions()
    {
        // We need to constantly check if the NPC died.
        if (m_fHealth <= 0)
        {
            m_eState = EWarriorState.WARRIOR_DEAD;
            return;
        }

        // The drone will rush to the homebase while it's holding the flag.
        if (true == m_bHasFlag)
        {
            if (m_v3Target != m_goHomeBase.transform.position)
            {
                // Ensure that we're headed towards our base.
                m_v3Target = m_goHomeBase.transform.position;

                MoveOrder(m_v3Target);
                m_eState = EWarriorState.WARRIOR_MOVING;
            }
            return;
        }

        // Get a handle on the closest enemy and calculate distance from it.
        m_trClosestEnemy = GetClosestEnemy();
        if (null != m_trClosestEnemy)
        {
            float fDistance = Vector3.Distance(m_trClosestEnemy.transform.position, transform.position);

            if (fDistance <= Constants.DEFAULT_ATTACK_RANGE)
            {
                m_v3Target       = Vector3.zero;
                m_eState         = EWarriorState.WARRIOR_ATTACKING;
                m_bTargetInRange = true;
            }
        }
        else
        {
            m_bTargetInRange   = false;
            m_bIsBeingAttacked = false;
        }

        // According to current state, we will check if we need to transition to
        //  a different state.
        switch (m_eState)
        {
        case EWarriorState.WARRIOR_IDLE:

            if (true == m_bIsBeingAttacked)
            {
                // Attempt to decide if we should attack or flee.
                if (m_fHealth < Constants.DEFAULT_HEALTH_WARRIOR / 2)
                {
                    // There's a 4 in 6 chance that the drone will try to run to home base.
                    if (Random.Range(0, 5) < 4)
                    {
                        m_v3Target = m_goHomeBase.transform.position;
                        m_eState   = EWarriorState.WARRIOR_MOVING;
                        break;
                    }
                }
            }

            if (Vector3.zero != m_v3Target)
            {
                MoveOrder(m_v3Target);
                m_eState = EWarriorState.WARRIOR_MOVING;
            }

            break;

        case EWarriorState.WARRIOR_MOVING:
            break;

        case EWarriorState.WARRIOR_ATTACKING:

            if (null == m_trClosestEnemy)
            {
                // The enemy has been destroyed, switch back to idle.
                m_eState           = EWarriorState.WARRIOR_IDLE;
                m_v3Target         = Vector3.zero;
                m_bTargetInRange   = false;
                m_bIsBeingAttacked = false;
                break;
            }

            StartCoroutine(AttackTarget(m_trClosestEnemy.transform));

            float fDistance = Vector3.Distance(m_trClosestEnemy.transform.position, transform.position);

            if (fDistance > Constants.DEFAULT_ATTACK_RANGE + 20f)
            {
                m_v3Target       = m_trClosestEnemy.transform.position;
                m_eState         = EWarriorState.WARRIOR_MOVING;
                m_bTargetInRange = false;
            }

            break;
        }
    }