IEnumerator applyDelay(WalkOnRoute walker) { if (walker.arrived()) { for (float timer = 0f; timer < delay; timer += Time.deltaTime) { if (walker.inTransit) { timer -= Time.deltaTime; // cheeky way to pause the countdown if the char is aggressing } yield return(null); } // yield return new WaitForSeconds( delay ); // Debug.Log( "changing to next waypoint" ); walker.setWaypoint(next); if (walker.keepMoving) { walker.startTransit(); } } }
// Use this for initialization void Start() { scan = GetComponent <Scanner>(); router = GetComponent <WalkOnRoute>(); mb = GetComponent <Mob>(); }
// Use this for initialization void Awake() { truck = GetComponent <WalkOnRoute>(); }
void arrived(WalkOnRoute walker) { StartCoroutine("applyDelay", walker); }
// Use this for initialization void Start() { walker = GetComponent <WalkOnRoute>(); target = ParticipantManager.instance.player.GetComponent <Mob>(); boxTarget = ParticipantManager.instance.box.GetComponent <Collider>(); }