Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        playerObject = GameObject.FindGameObjectWithTag("Player");

        flockManager = new FlockManager();
        foreach (GameObject go in Waypoints)
        {
            flockManager.AddWaypoint(go.GetComponent <FlockControllerWaypoint>());
        }

        flockMembers = new GameObject[numberOfMembers];
        for (int i = 0; i < numberOfMembers; i++)
        {
            Vector3 memberStartPosition = new Vector3(Random.Range(-range.x, range.x),
                                                      Random.Range(-range.y, range.y),
                                                      Random.Range(0, 0));
            flockMembers[i] = Instantiate(memberPrefab, this.transform.position + memberStartPosition,
                                          Quaternion.identity) as GameObject;
            flockMembers[i].GetComponent <FlockMember>().SetManager = this.gameObject;
        }

        currentWaypoint = flockManager.GetNextWaypoint();
    }