Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     player     = GameObject.Find("SpaceBoy").transform;
     timerToGo  = Random.Range(30f, 250f);
     anim       = GetComponent <Animator>();
     rigidBody  = GetComponent <Rigidbody>();
     usagiState = usagiAction.Idle;
     usagiBody  = transform.Find("Body");
 }
Exemplo n.º 2
0
 void lookOut()
 {
     if (playerDistance <= 5f)
     {
         usagiState = usagiAction.Run;
         anim.SetBool("isHop", false);
         anim.SetBool("isRun", true);
     }
 }
Exemplo n.º 3
0
 void run()
 {
     setRunDirection();
     speed = runspeed;
     anim.SetBool("isRun", true);
     if (playerDistance >= 10f)
     {
         usagiState = usagiAction.Idle;
         anim.SetBool("isRun", false);
     }
 }
Exemplo n.º 4
0
 void idle()
 {
     moveDir    = new Vector3(0, 0, 0);
     timerToGo -= 1f;
     if (timerToGo <= 0)
     {
         usagiState = usagiAction.Walk;
         timerToGo  = Random.Range(30f, 250f);
         randomDirection();
     }
     lookOut();
 }
Exemplo n.º 5
0
 void walk()
 {
     speed = walkspeed;
     anim.SetBool("isHop", true);
     timerToGo -= 1f;
     if (timerToGo <= 0)
     {
         usagiState = usagiAction.Idle;
         timerToGo  = Random.Range(30f, 250f);
         anim.SetBool("isHop", false);
     }
     lookOut();
 }