void insertCore()
    {
        string[] firstYear  = ProgramObjectController.getCoreClasses(1);
        string[] secondYear = ProgramObjectController.getCoreClasses(2);
        string[] thirdYear  = ProgramObjectController.getCoreClasses(3);

        for (int i = 0; i < allCourses.GetLength(0); i++)
        {
            for (int j = 0; j < allCourses.GetLength(1); j++)
            {
                string[] courseName = null;

                if (i == 0)
                {
                    courseName = firstYear;
                }
                else if (i == 1)
                {
                    courseName = secondYear;
                }
                else if (i == 2)
                {
                    courseName = thirdYear;
                }

                if (j < courseName.Length)
                {
                    allCourses[i, j] = courseName[j];

                    //Debug.Log (courseName[j] + " @ " + i + "," + j);
                }
            }
        }
    }
    public void setCurrentProgram(string programCode)
    {
        for (int i = 0; i < programs.Count; i++)
        {
            string code = programs[i]["code"];
            if (code == programCode)
            {
                ProgramObjectController.setProgram(programs[i]);
                return;
            }
        }

        ProgramObjectController.setProgram(null);
    }
    void instantiateControllers()
    {
        aiController       = GameObject.FindGameObjectWithTag("AIController").GetComponent <AIController>();
        waypointController = GameObject.FindGameObjectWithTag("WaypointController").GetComponent <WaypointController>();

        waypointController.createWaypoints(ammountOfWaypoints);
        aiController.createCars(ammountOfAi);

        guiController = GameObject.FindGameObjectWithTag("GUIController").GetComponent <GUIController>();

        inGameGuiController = GameObject.FindGameObjectWithTag("GUIController").GetComponent <InGameGUIController>();

        guiController.setProgram(ProgramObjectController.getProgram(), null);
    }
    public void playerAtWaypoint()
    {
        if (currentCourseIndex >= endGameIndexs [0] && currentYearIndex >= endGameIndexs [1])
        {
            endGame();
            return;
        }
        int tmpI = currentYearIndex;
        int tmpJ = currentCourseIndex + 1;

        if (currentCourseIndex >= allCourses.GetLength(1) - 1)
        {
            tmpI = currentYearIndex + 1;
            tmpJ = 0;
        }

        completedCourses++;

        if (allCourses [tmpI, tmpJ] == null)
        {
            inGameGuiController.displayMajorMenu(ProgramObjectController.getMajors(), true);
            return;
        }


        if (currentCourseIndex >= allCourses.GetLength(1) - 1)
        {
            currentYearIndex++;
            currentCourseIndex = 0;
        }
        else
        {
            currentCourseIndex++;
        }



        currentCourse = allCourses[currentYearIndex, currentCourseIndex];
        waypointController.SendMessage("selectWaypoint");
        updateGui();
    }
    void setMajorCourses(string[] majorCourses)
    {
        string majorName = ProgramObjectController.getMajorName();

        int index = 0;

        for (int i = 0; i < allCourses.GetLength(0); i++)
        {
            for (int j = 0; j < allCourses.GetLength(1); j++)
            {
                if (allCourses[i, j] == null && majorCourses[index] != null)
                {
                    Debug.Log(i + " " + j + " " + index);
                    Debug.Log(majorCourses[index]);
                    index++;
                }
            }
        }

        playerAtWaypoint();
        guiController.setProgram(ProgramObjectController.getProgram(), majorName);
    }
    void selectMajor(string majorName)
    {
        Debug.Log(majorName);

        ProgramObjectController.setAndComeBack(majorName);
    }