public void SpawnAI(ICollection <InputDevice> playerInputDevices) { for (int i = 0; i < _AICount; i++) { GameObject go = Instantiate(_AIPrefab); go.transform.position = pathFindingMesh.GetRandomPoint(); MeshRenderer mr = go.GetComponentInChildren <MeshRenderer>(); mr.material.color = humanColor.GetColor(); } }
void Update() { if (status == Status.Wait && _TimeToNextWaypointRequest > 0) { _TimeToNextWaypointRequest -= Time.deltaTime; } if (_TimeToNextWaypointRequest <= 0) { target = pathFindingMesh.GetRandomPoint(); _TimeToNextWaypointRequest = Random.Range(_MinTimeToNextPoint, _MaxTimeToNextPoint); waypoints = pathFindingMesh.GetPath(this.transform.position, target); status = Status.Move; } if (status == Status.Move) { Move(); } }