Example #1
0
 void RundomWalk()
 {
     if (targetMobs.Any())
     {
         if (target)
         {
             if (Vector3.Distance(target.transform.position, transform.position) < runDistance)
             {
                 mobPattern = MobPattern.RUN;
                 MoveRandom(RandomRunPosrange);
                 navMeshAgent.speed = runSpeed;
                 return;
             }
         }
         //視界に入ってなくても逃げ始める
         else if (Vector3.Distance(targetMobs[0].transform.position, transform.position) < runDistance / 2)
         {
             target     = targetMobs[0];
             mobPattern = MobPattern.RUN;
             MoveRandom(RandomRunPosrange);
             navMeshAgent.speed = runSpeed;
             return;
         }
     }
 }
Example #2
0
 void Wait()
 {
     if (targetMobs.Any())
     {
         if (Vector3.Distance(targetMobs[0].transform.position, transform.position) < walkDistance * 3)
         {
             mobPattern = MobPattern.RUNDOMWAIK;
             MoveRandom(RandomWalkPosRange);
             navMeshAgent.speed = walkSpeed;
             return;
         }
     }
 }
Example #3
0
 void Run()
 {
     if (targetMobs.Any())
     {
         if ((Vector3.Distance(targetMobs[0].transform.position, transform.position) > runDistance))
         {
             target     = null;
             mobPattern = MobPattern.RUNDOMWAIK;
             MoveRandom(RandomWalkPosRange);
             navMeshAgent.speed = walkSpeed;
             return;
         }
     }
     else
     {
         target     = null;
         mobPattern = MobPattern.RUNDOMWAIK;
         MoveRandom(RandomWalkPosRange);
         navMeshAgent.speed = walkSpeed;
         return;
     }
 }