public void mungGoonSound() { int i = UnityEngine.Random.Range(1, 6); switch (i) { case 1: aud.PlayOneShot(mungGoon1); break; case 2: aud.PlayOneShot(mungGoon2); break; case 3: aud.PlayOneShot(mungGoon3); break; case 4: aud.PlayOneShot(mungGoon4); break; case 5: aud.PlayOneShot(mungGoon5); break; } JangGoonSound.SetActive(false); PlayingSound.SetActive(true); }
void attack_RPC(string lastTouchSensor, string touchTargetSensor) { GameObject lastTouch = GameObject.Find(lastTouchSensor).GetComponent <SensorControl>().getCollisionObj(); GameObject touchTarget = GameObject.Find(touchTargetSensor).GetComponent <SensorControl>().getCollisionObj(); preSensor = lastTouchSensor; nowSensor = touchTargetSensor; lastTouch.transform.position = touchTarget.transform.position; lastMovedPosition = setMovePosition(touchTarget); moveSound(lastTouch); Destroy(touchTarget); if (nowTurn.Equals("Han")) { nowTurn = "Cho"; } else { nowTurn = "Han"; } if (touchTarget.name.Equals("Han_King(Clone)") || touchTarget.name.Equals("Cho_King(Clone)")) { if (touchTarget.name.Substring(0, 3).Equals(myTag)) // 패배 { aud.PlayOneShot(loseSound); LosePanel.SetActive(true); PlayingSound.SetActive(false); JangGoonSound.SetActive(false); } else // 승리 { aud.PlayOneShot(winSound); WinPanel.SetActive(true); PlayingSound.SetActive(false); JangGoonSound.SetActive(false); } } else { StartCoroutine("JangGoonCheck"); } }
void FixedUpdate() { if (Input.GetMouseButtonDown(0) && nowTurn.Equals(myTag)) { touchTarget = GetClickedObject(); if (!touchTarget.tag.Equals("Field")) { removeAllEnemyObjs(); if (lastMeObj != null) { removeObj(lastMeObj); } if (lastMovedPosition != null) { removeObj(lastMovedPosition); } } if (touchTarget.tag.Equals("Han") || touchTarget.tag.Equals("Cho")) // 말 선택시 { if (isChoosing && !touchTarget.tag.Equals(myTag)) // 말 선택 중 다른 팀 선택 했을때 { if (touchTarget.GetComponent <MalScript>().getSensorObj().GetComponent <Renderer>().enabled) { view.RPC("attack_RPC", PhotonTargets.All, lastTouch.GetComponent <MalScript>().getSensorObj().name, touchTarget.GetComponent <MalScript>().getSensorObj().name); offAllSensors(); isChoosing = false; } } else if (touchTarget.tag.Equals(myTag)) // 자기 팀을 선택 하면 { offAllSensors(); lastMeObj = setMeObj(touchTarget); lastTouch = touchTarget; if (publicVariable.getIsModeling()) { touchVoice(touchTarget.name); } searchPath.searchPath(touchTarget.GetComponent <MalScript>().getSensorObj().name, touchTarget.name); isChoosing = true; } } else if (touchTarget.tag.Equals("Sensor")) // 센서 선택시 { if (isChoosing && touchTarget.GetComponent <Renderer>().enabled) // 말 선택 중 이동가능한 센서 선택시 { preSensor = lastTouch.GetComponent <MalScript>().getSensorObj().name; view.RPC("move_RPC", PhotonTargets.All, preSensor, touchTarget.name); isChoosing = false; offAllSensors(); } } } if (!publicVariable.getIsPlayer()) // 상대나가면 승리 { aud.PlayOneShot(winSound); WinPanel.SetActive(true); PlayingSound.SetActive(false); JangGoonSound.SetActive(false); } }