Example #1
0
    void RunAway()
    {
        // 이전 상태 초기화
        navOn   = false;
        timerOn = false;

        //Debug.Log("HARE Start RunAway");
        nav.ResetPath();
        hareState = HARESTATE.runaway;
        hareAnimator.SetBool("isRun", true);
        nav.speed   = runSpeed;
        destination = transform.position - runAwayTarget.transform.position;
        nav.SetDestination(transform.position + destination.normalized * 5);

        if (runAwayTimer >= runAwayTIme)
        {
            nav.ResetPath();
            runAwayTimer = 0;
            hareAnimator.SetBool("isRun", false);
            hareState = HARESTATE.ordinary;
            Debug.Log("End RunAway");
        }
        else
        {
            runAwayTimer += Time.deltaTime;
        }
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     HP               = 100;
     nav              = gameObject.GetComponent <NavMeshAgent>();
     hareAnimator     = GetComponent <Animator>();
     hareState        = HARESTATE.ordinary;
     roarSound        = GetComponent <AudioSource>();
     idleRandomNumber = 0;
     runAwayTimer     = 0;
 }
Example #3
0
 void DeadCheck()
 {
     if (HP <= 0)
     {
         hareAnimator.SetBool("isDead", true);
         hareState = HARESTATE.dead;
         if (GameGoal.Instance().goal[2] >= 1)
         {
             GameGoal.Instance().goal[2]--;
             GameGoal.Instance().sumGoal--;
         }
     }
 }