Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (stop)
     {
         return;
     }
     // always in movement. The only opportunity to stop is when chase action takes place
     walk.walk(dir * speed);
 }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     if (stop)
     {
         return;
     }
     // calculate sign direction
     signDir = Mathf.Sign(target.position.x - transform.position.x);
     if (patrol != null)
     {
         patrol.setNewDir(signDir);
     }
     else
     {
         walk.walk(signDir * speed);
     }
 }