Ejemplo n.º 1
0
    // Called when all rooms have been added to the scene
    // Given list of connected rooms in order
    public void RoomsAdded(List <GameObject> rooms)
    {
        List <Vector3> p = new List <Vector3> ();

        pathIndexToRoom = new SortedDictionary <int, int> ();

        if (rooms == null || rooms.Count == 0)
        {
            return;
        }

        for (int roomIndex = 0; roomIndex < rooms.Count; roomIndex++)
        {
            Vector3[] temp = worldCreator.GetPathPoints(rooms [roomIndex]);

            if (roomIndex == 0)
            {
                p.Add(new Vector3(temp[0].x, temp[0].y, temp[0].z - startDist));
                pathIndexToRoom.Add(p.Count, 0);
                p.Add(temp[0]);
            }

            for (int pathIndex = 1; pathIndex < temp.Length; pathIndex++)
            {
                pathIndexToRoom.Add(p.Count, roomIndex);
                p.Add(temp[pathIndex]);
            }
        }

        path = new MyPath(p.ToArray());
    }