public void Init(ClientPlaceZone placeZone, float timeTimer, List <string> order) { PlaceZone = placeZone; _timerTime = timeTimer; placeZone.SetClient(this); SetOrder(order); SetTryPlaceController(_trayPlace); _navMesh = GetComponent <NavMeshAgent>(); _navMesh.SetDestination(placeZone.transform.position); }
public void TryPlace() { ClientPlaceZone zone = Places.FirstOrDefault((place) => place.IsFree); if (zone != null) { GameManager gm = GameManager.Instance; Vector3 spawnPos = gm.ClientSpawnPoints[Random.Range(0, gm.ClientSpawnPoints.Count)].position; ClientController client = Instantiate(gm.ClientPrefab, spawnPos, transform.rotation).GetComponent <ClientController>(); List <string> order = GameManager.RandomOrder; client.Init(zone, Random.Range(gm.MinTimeTimer, gm.MaxTimeTimer), order); } }