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 void Start()
    {
        manager = script_Manager.Instance;

        if (team >= 0)
        {
            manager.AddToTeam(team, gameObject);

            Renderer[] renderers = GetComponentsInChildren <Renderer>();
            towers = new GameObject[renderers.Length];

            for (int i = 0; i < renderers.Length; i++)
            {
                renderers[i].material.SetColor("_EmissionColor", manager.GetTeamColor(team));
                renderers[i].gameObject.AddComponent <script_explosion>();

                towers[i] = renderers[i].gameObject;
            }
        }
    }
Esempio n. 3
0
 private void Start()
 {
     manager = script_Manager.Instance;
     manager.AddToTeam(team, transform.parent.gameObject);
     gameObject.GetComponent <Renderer>().material.SetColor("_EmissionColor", manager.GetTeamColor(team));
 }