void OnDestroyedRPC(int kind, Vector3 position, Quaternion rotation, NetworkViewID viewID, string userName) { DestroyedSendMsgParam param = new DestroyedSendMsgParam(); param.kind = kind; param.position = position; param.rotation = rotation; param.viewID = viewID; GlobalInfo.eventHandler.SendMessage("OnDestroyed", param, SendMessageOptions.DontRequireReceiver); if (Network.isServer) { for (int i = 0; i < GlobalInfo.userInfoList.Count; i++) { if (GlobalInfo.userInfoList[i].name.Equals(userName)) { GlobalInfo.userInfoList[i].destroyed = true; break; } } GlobalInfo.eventHandler.SendMessage("OnUpdateUserList", SendMessageOptions.DontRequireReceiver); if (GlobalInfo.gameStarted) { if (DetectGameOver()) { GlobalInfo.rpcControl.RPC("OnGameOverRPC", RPCMode.All); } } } }
void OnDestroyed(DestroyedSendMsgParam param) { Instantiate(destroyedObject[param.kind], param.position, param.rotation); if (GlobalInfo.playerViewID.Equals(param.viewID)) { Camera.main.GetComponent <AudioListener>().enabled = true; } }