public void Spawn(int count) { if (prefab) { GameObject bO = (Instantiate(prefab, transform.position, Quaternion.identity) as GameObject); script_boidGroup bG = bO.GetComponent <script_boidGroup>(); bG.SetTeam(team); bG.waypoint = startingPoints[Random.Range(0, startingPoints.Count)]; for (int i = 0; i < count; i++) { bG.AddToGroup(manager.GetTeamColor(team), 5.0f); } manager.AddToTeam(team, bO); } }
private bool TransferOwnership(int team) { if (team != -1) { GetComponent <SphereCollider>().enabled = false; group.enabled = true; for (int i = 0; i < count; i++) { group.boids[i].enabled = true; group.boids[i].GetComponent <Collider>().enabled = true; } group.SetTeam(team); group.ResetColor(); script_Manager.Instance.AddToTeam(team, group.gameObject); return(true); } return(false); }