void OnSceneGUI() { path = (Utility_Path)target; for (int i = 0; i < path.nodes.Count; i++) { path.nodes[i] = Handles.PositionHandle(path.nodes[i], Quaternion.identity); } }
void SpawnThrombocyte() { Utility_Path cellPath = RandomPath(); GameObject instance = Instantiate(Thrombocyte, cellPath.transform.position, Quaternion.identity); Utility_FollowSpline cellMovement = instance.GetComponent <Utility_FollowSpline>(); cellMovement.pathName = cellPath.name; Destroy(instance, 6f); }
Utility_Path RandomPath() { pathCounter++; if (pathCounter == cellPaths.Length - 1) { //shuffle array for (int i = 0; i < cellPaths.Length; i++) { Utility_Path temp = cellPaths[i]; int randomIndex = Random.Range(i, cellPaths.Length); cellPaths[i] = cellPaths[randomIndex]; cellPaths[randomIndex] = temp; } pathCounter = 0; } return(cellPaths[pathCounter]); }