public void SetupScene() { for (var i = 0; i < g_NumFloakAgents; i++) { var groupRadius = Random.insideUnitCircle * g_GroupeRadius; var pos = new Vector3(groupRadius.x, 0, groupRadius.y) + g_SpawnLocation.position; AllAgents[i] = Instantiate(g_FloakingPrefab, pos, Quaternion.identity); Floak floak = AllAgents[i].GetComponent <Floak>(); floak.groupe = this; g_GoalPos = g_SpawnLocation.position; //AllAgents[i].transform.parent = gameObject.transform; } }
private void ChangeElementsColor(Material newMaterial) { foreach (GameObject GO in AllAgents) { Floak floak = GO.GetComponent <Floak>(); if (floak != null) { //Debug.Log(gameObject + ": change mat"); floak.rend.material = newMaterial; } else { Debug.LogWarning(gameObject + ": no rend found"); } } }
public void SetupGroup(GameObject[] floakObjectList) { Debug.Log(gameObject + ": setup group; " + floakObjectList.Length + " floaks found"); // bind each floak foreach (GameObject obj in floakObjectList) { Floak floak = obj.GetComponent <Floak>(); floak.groupe = this; } // init the float list this.AllAgents = floakObjectList; // set goal direction g_GoalPos = GetBarycenter(floakObjectList); }