/// <summary> /// Called by the shopper when it reaches the exit. /// </summary> /// <param name="s"></param> public void Spawn(Shopper s) { s.simulation = this; if (s.Behavior == Shopper.BehaviorType.ShoppingList) { var path = m_WaypointGraph.GenerateRandomPath(6); if (path != null) { s.SetPath(path); } } if (s.m_Path == null) { // Pick a random entrance for the start position var startWp = m_Entrances[UnityEngine.Random.Range(0, m_Entrances.Count)]; s.SetWaypoint(startWp); } // Randomize the movement speed between [.75, 1.25] of the default speed var speedMult = UnityEngine.Random.Range(.5f, 1f); s.Speed = ShopperSpeed * speedMult; if (m_NumInfectious < DesiredNumInfectious) { s.InfectionStatus = Shopper.Status.Infectious; m_NumInfectious++; } }