예제 #1
0
파일: Hare.cs 프로젝트: josung50/Portfolio
    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;
        }
    }
예제 #2
0
파일: Hare.cs 프로젝트: josung50/Portfolio
 // 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;
 }
예제 #3
0
파일: Hare.cs 프로젝트: josung50/Portfolio
 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--;
         }
     }
 }