コード例 #1
0
ファイル: Controller.cs プロジェクト: tudorgergely/Labs
        public void addStudent(int id, String name, int grade, String supervisor, String thesis, int grade2)
        {
            Student s = new PhDStudent(id, name, grade, supervisor, thesis, grade2);

            this.val.validateStudent(s);
            repo.addElement(s);
        }
コード例 #2
0
 void unselect(PhDStudent student)
 {
     transform.parent.GetComponent <PhDStudentInvestView>().studentsChosen.Remove(student);
     selectButton.GetComponentInChildren <Text>().text = "Select";
     selectButton.GetComponentInChildren <Button>().onClick.AddListener(() => {
         select(student);
     });
 }
コード例 #3
0
 public String addStudent(int id, String name, int grade, String supervisor, String thesis, int grade2)
 {
     try
     {
         Student s = new PhDStudent(id, name, grade, supervisor, thesis, grade2);
         val.validateStudent(s);
         repo.addElement(s);
         return("Student added successfully!");
     }
     catch (MyException ex)
     {
         return(ex.getMessage());
     }
 }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        // Initialization
        gameManager    = GameManager.instance;
        nameView       = transform.Find("NameView").GetComponent <Text>();
        selectButton   = transform.Find("SelectButton").GetComponent <Button>();
        lowestFameView = transform.Find("FameReqView").GetComponent <Text>();

        // Generate a random PhD student
        // Generate gender
        int gender = Random.Range(0, 2);

        // Generate gender related name
        string firstName;
        string lastName;

        if (gender > 0)
        {
            firstName = CharacterContentLibrary.maleFirstNames[Random.Range(0, CharacterContentLibrary.maleFirstNames.Length)];
        }
        else
        {
            firstName = CharacterContentLibrary.femaleFirstNames[Random.Range(0, CharacterContentLibrary.femaleFirstNames.Length)];
        }
        lastName = CharacterContentLibrary.lastNames[Random.Range(0, CharacterContentLibrary.lastNames.Length)];

        student = new PhDStudent(firstName, lastName, PhDStudent.defaultNumYears);

        // Generate a fameRequirement
        int fameReq = Random.Range(minLowestFame, maxLowestFame);

        // Update UI
        nameView.text       = Util.UppercaseFirst(student.getFirstName()) + " " + Util.UppercaseFirst(student.getLastName());
        lowestFameView.text = "at least " + fameReq + " fame";
        selectButton.GetComponentInChildren <Button>().onClick.AddListener(() => gameManager.hirePhDStudent(student));
        if (gameManager.getCurrPlayer().getFame() < fameReq)
        {
            selectButton.enabled = false;
            selectButton.GetComponentInChildren <Text>().text = ":(";
        }
        else
        {
            selectButton.enabled = true;
            selectButton.GetComponentInChildren <Text>().text = "Hire";
        }
    }
コード例 #5
0
ファイル: Controller.cs プロジェクト: tudorgergely/Labs
 public String addStudent(int id, String name, int grade, String supervisor, String thesis, int grade2)
 {
     try
     {
         Student s = new PhDStudent(id, name, grade, supervisor, thesis, grade2);
         val.validateStudent(s);
         repo.addElement(s);
         foreach (var observer in observers)
         {
             observer.OnNext(this.repo.getAllElements());
         }
         return("Student added successfully!");
     }
     catch (MyException ex)
     {
         return(ex.getMessage());
     }
 }
コード例 #6
0
    public void hirePhDStudent(PhDStudent student)
    {
        // Abandoned Idea: Create a PhD student on the map
        //Vector2 newPosition = new Vector2(UnityEngine.Random.Range(0.0f, 0.2f), UnityEngine.Random.Range(0.0f, 0.2f));
        //GameObject studentObj = Instantiate(Resources.Load<GameObject>(ResourceLibrary.characterPrefab), characters[currPlayer].transform.position, Quaternion.identity, GameObject.FindWithTag("CharacterContainer").transform);
        //studentObj.GetComponent<Character>().beAPhDStudent(student, getCurrPlayer(), getCurrPlayer().getCurrGridIdx());
        //List<Character> characterList = new List<Character>(characters);
        //characterList.Add(studentObj.GetComponent<Character>());
        //characters = characterList.ToArray();

        if (getCurrPlayer().getNumPhDStudent() >= Character.maxNumPhDStudent)
        {
            Debug.Log(characters[currPlayer].name + " has too many PhD students to hire more.");
            return;
        }
        Debug.Log("PhD student " + student.getFirstName() + " " + student.getLastName() + " has been hired by " + characters[currPlayer].name);

        getCurrPlayer().addAPhDStudent(student);

        recruitmentDialog.SetActive(false);
        characterTurnEnds();
    }
コード例 #7
0
 public void fireAPhDStudent(PhDStudent student)
 {
     phdstudents.Remove(student);
 }
コード例 #8
0
 public void addAPhDStudent(PhDStudent newStudent)
 {
     phdstudents.Add(newStudent);
 }