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

        //Debug.Log("Stag Start RunAway");
        nav.ResetPath();
        stagState = STAGSTATE.runaway;
        stagAnimator.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;
            stagAnimator.SetBool("isRun", false);
            stagState = STAGSTATE.ordinary;
            //Debug.Log("End RunAway");
        }
        else
        {
            runAwayTimer += Time.deltaTime;
        }
    }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     HP               = 100;
     nav              = gameObject.GetComponent <NavMeshAgent>();
     stagAnimator     = GetComponent <Animator>();
     stagState        = STAGSTATE.ordinary;
     roarSound        = GetComponent <AudioSource>();
     idleRandomNumber = 0;
     runAwayTimer     = 0;
 }
コード例 #3
0
 void DeadCheck()
 {
     if (HP <= 0)
     {
         stagAnimator.SetBool("isDead", true);
         stagState = STAGSTATE.dead;
         if (GameGoal.Instance().goal[1] >= 1)
         {
             GameGoal.Instance().goal[1]--;
             GameGoal.Instance().sumGoal--;
         }
     }
 }