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(); }
// 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"; } }
void updateUI() { nameView.text = Util.UppercaseFirst(student.getFirstName()) + " " + Util.UppercaseFirst(student.getLastName()); numYearLeftView.text = student.getNumYearLeft() + " years left"; fireButton.GetComponentInChildren <Button>().onClick.AddListener(() => { supervisor.fireAPhDStudent(student); Destroy(gameObject); }); }
void updateUI() { nameView.text = Util.UppercaseFirst(student.getFirstName()) + " " + Util.UppercaseFirst(student.getLastName()); numYearLeftView.text = student.getNumYearLeft() + " years left"; selectButton.GetComponentInChildren <Button>().onClick.AddListener(() => { select(student); }); }