/* wait until talking with Student 3 */ IEnumerator PickStudent() { yield return new WaitForSeconds(2.5f); while (true) { /* When talking with student3, make special effect */ if (GameObject.Find("학생3").GetComponent<Dialogue>().getDialogueOnOff() == true) { int i; GetComponent<AudioSource>().PlayOneShot(ShockSound); maincam.GetComponent<Camera>().orthographicSize = 3; do { i = Random.Range(1, 101); } while (i % 10 != 0 && i % 10 != 1); Student stu = new Student((stu_no)i); GameManager.pl_stored.GetComponent<CharacterStatus>().setStudent(stu); stu.levelUP(); stu.levelUP(); warp.SetActive(true); break; } yield return new WaitForSeconds(3.5f); } /* Call Dialogue of Additional picking conversation */ while (true) { if (GameObject.Find("학생3").GetComponent<Dialogue>().getDialogueOnOff() == false) { GameObject.Find("StoryDirector").GetComponent<NPCStatus>().interaction(GameManager.pl_stored); break; } yield return new WaitForSeconds(0.5f); } /* Zoom Out when dialogue fininshed */ while (true) { if (GameObject.Find("StoryDirector").GetComponent<Dialogue>().getDialogueOnOff() == false) { maincam.GetComponent<Camera>().orthographicSize = 7; break; } yield return new WaitForSeconds(0.5f); } float fade = maincam.GetComponent<Fading>().BeginFade(1); yield return new WaitForSeconds(fade); GameManager.ChangeMap(1); }
void OnTriggerStay2D(Collider2D other) { if (other.gameObject.tag == "Player" && inProgress == false) { Debug.Log("field collision occured"); float level_sum = 0; /* Randomly Emgerge Student */ if (Random.Range(1, 1000000) < probability_million) { bool playerValidity = false; int type; Student wild_student; /* setting player battle info */ GameManager.resetBattleStudents(); for (int i = 0; i < 6; i++) GameManager.setBattlePlayerStudent(i, GameManager.pl_stored.GetComponent<CharacterStatus>().getStudent(i)); /* check validity */ for (int i = 0; i < 6; i++) { Student player_stu = GameManager.pl_stored.GetComponent<CharacterStatus>().getStudent(i); if (player_stu != null && player_stu.getHP() >= 1) playerValidity = true; } /* setting wild student and application level */ if (playerValidity) { for (int i = 0; i < 6; i++) { Student stu = GameManager.pl_stored.GetComponent<CharacterStatus>().getStudent(i); if (stu != null) level_sum += stu.getLevel(); } do { type = Random.Range(1, 101); } while (type % 10 != 0 && type % 10 != 1); /* setting wild student */ wild_student = new Student((stu_no)type); float target_level = (level_sum / GameManager.pl_stored.GetComponent<CharacterStatus>().getStudentCount()); for (int i = 0; i < leveling_limit; i++) { if (Random.value < leveling_probability) target_level += 1; } target_level *= level_multiplier; for (int i = 0; i < target_level; i++) wild_student.levelUP(); GameManager.setBattleTrainerStudent(0, wild_student); GameManager.setBattleHostNum(0); StartCoroutine(LoadLevel()); } } } }