private void OnTriggerEnter(Collider other) { if (other.tag == "Dog") { if (!Goal_in) { p1_rec.RecordStop(); m_goal_info.SetActive(true); m_multyManager.goal = true; m_player1.MoveSpeed = 0; Goal_in = true; if (!Goal_p1) { Goal_p1 = true; m_goal_text.text = "Player 1이 이겼습니다. 기록:" + p1_rec.replayTime.ToString(); } } if (Goal_in) { p1_rec.RecordStop(); m_player1.MoveSpeed = 0; if (!Goal_p1) { Record_button.SetActive(true); Goal_p1 = true; m_goal_text.text = m_goal_text.text + "\n Player1의 기록" + p1_rec.replayTime.ToString(); } } } if (other.tag == "Penguin") { if (!Goal_in) { p2_rec.RecordStop(); m_goal_info.SetActive(true); m_multyManager.goal = true; m_player2.MoveSpeed = 0; Goal_in = true; if (!Goal_p2) { Goal_p2 = true; m_goal_text.text = "Player 2이 이겼습니다. 기록:" + p2_rec.replayTime.ToString(); } } if (Goal_in) { p2_rec.RecordStop(); m_player2.MoveSpeed = 0; if (!Goal_p2) { Record_button.SetActive(true); Goal_p2 = true; m_goal_text.text = m_goal_text.text + "\n Player2의 기록" + p2_rec.replayTime.ToString(); } } } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Dog") //Dog가 Player1이므로 Player1이 골에 충돌하면 { if (!Goal_in) //아직 한명도 통과 하지 못했다면 { p1_rec.RecordStop(); //Player1의 기록을 정지합니다 m_goal_info.SetActive(true); //골인 UI를 출력합니다 m_multyManager.goal = true; //멀티매니저에 goal을 true로 둡니다 m_player1.MoveSpeed = 0; //플레이어가 움직이지 못하게 Movespeed를 0으로 둡니다 Goal_in = true; //플레이어1이 들어왔으므로 true를 줍니다 if (!Goal_p1) //Goal_P1이 false이므로 true로 바꾸며 경과시간을 text로 출력합니다 { Goal_p1 = true; m_goal_text.text = "Player 1이 이겼습니다. 기록:" + p1_rec.replayTime.ToString(); } } if (Goal_in) //이미 골라인을 통과한 사람이 있는 상태에서 Player1이 들어오면 { p1_rec.RecordStop(); //플레이어1의 기록을 멈춘다 m_player1.MoveSpeed = 0; //플레이어1의 속도를 0으로 만든다 if (!Goal_p1) //Goal_p1이 false이므로 { Record_button.SetActive(true); Goal_p1 = true; //기록저장 버튼을 출력하며 Goal_p1이 값을 true로 바꾸고 시간을 출력합니다 m_goal_text.text = m_goal_text.text + "\n Player1의 기록" + p1_rec.replayTime.ToString(); } } } if (other.tag == "Penguin")//펭귄은 AI역할이므로 아래에서 적용하는 부분은 player의 반대되는 역할을 합니다 { if (!Goal_in) { p2_rec.RecordStop(); m_goal_info.SetActive(true); m_multyManager.goal = true; m_player2.MoveSpeed = 0; Goal_in = true; if (!Goal_p2) { Goal_p2 = true; //플레이어2(AI)가 이겼다고 출력합니다 m_goal_text.text = "Player 2이 이겼습니다. 기록:" + p2_rec.replayTime.ToString(); } } if (Goal_in) { p2_rec.RecordStop(); m_player2.MoveSpeed = 0; if (!Goal_p2) { Record_button.SetActive(true); Goal_p2 = true; m_goal_text.text = m_goal_text.text + "\n Player2의 기록" + p2_rec.replayTime.ToString(); } } } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Dog") { if (!m_Goal) { GoalMessge.SetActive(true); float time = other.gameObject.transform.GetComponent <AnimalTimer>().m_Animal_Timer; GoalText.text = "Player가 이겼습니다 \n 기록 : " + time.ToString(); m_Goal = true; } else { float time = other.gameObject.transform.GetComponent <AnimalTimer>().m_Animal_Timer; GoalText.text = GoalText.text + "\n Player기록 :" + time.ToString(); RecordButton.SetActive(true); dog_record.RecordStop(); peng_record.RecordStop(); } } if (other.tag == "Penguin") { if (!m_Goal) { GoalMessge.SetActive(true); float time = other.gameObject.transform.GetComponent <AnimalTimer>().m_Animal_Timer; GoalText.text = "Player가 졌습니다 \n AI기록 : " + time.ToString(); m_Goal = true; } else { float time = other.gameObject.transform.GetComponent <AnimalTimer>().m_Animal_Timer; GoalText.text = GoalText.text + "\n AI기록 :" + time.ToString(); RecordButton.SetActive(true); dog_record.RecordStop(); peng_record.RecordStop(); } } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Dog") //골라인에 Dog가 들어온경우 { if (!m_Goal) //플레이어 승리 메세지와 플레이 시간을 표시합니다 { GoalMessge.SetActive(true); float time = other.gameObject.transform.GetComponent <AnimalTimer>().m_Animal_Timer; GoalText.text = "Player가 이겼습니다 \n 기록 : " + time.ToString(); m_Goal = true; } else //플레이어가 승리했다고 표시하고, 경과시간과 팽귄이 골라인까지 걸린 시간을 표시하고 레코드 버튼을 활성화 시킵니다 { float time = other.gameObject.transform.GetComponent <AnimalTimer>().m_Animal_Timer; GoalText.text = GoalText.text + "\n Player기록 :" + time.ToString(); RecordButton.SetActive(true); dog_record.RecordStop(); //리플레이 클래스에서는 녹화를 정지합니다 peng_record.RecordStop(); } } if (other.tag == "Penguin") { if (!m_Goal) { GoalMessge.SetActive(true); float time = other.gameObject.transform.GetComponent <AnimalTimer>().m_Animal_Timer; GoalText.text = "Player가 졌습니다 \n AI기록 : " + time.ToString(); m_Goal = true; } else { float time = other.gameObject.transform.GetComponent <AnimalTimer>().m_Animal_Timer; GoalText.text = GoalText.text + "\n AI기록 :" + time.ToString(); RecordButton.SetActive(true); dog_record.RecordStop(); peng_record.RecordStop(); } } }