void OnDeparture(PhotonRPCModel model) { if (!GameManager.GetInstance().myInfo.isHost) { Departure(model.message); } }
void OnActionTicker(PhotonRPCModel model) { GameObject obj = Instantiate(tickerObject) as GameObject; obj.transform.SetParent(tickerParent); var ticker = obj.GetComponent<TickerController>(); ticker.Initialize(model.message); }
private void OnDeparture(PhotonRPCModel model) { if (!GameManager.GetInstance().myInfo.isHost) { SceneChange(); } }
public void OnSyncPositionEvent(PhotonRPCModel model) { SyncCommand command = JsonUtility.FromJson<SyncCommand>(model.message); if (characterDictionary.ContainsKey(model.senderId)) { characterDictionary[model.senderId].RepositionPlayer(command); } }
private void KillEvent(PhotonRPCModel model) { KillCommandSample command = JsonUtility.FromJson<KillCommandSample>(model.message); if (command.target == gameObject.name) { Destroy(gameObject); } }
private void MoveEvent(PhotonRPCModel model) { MoveCommandSample command = JsonUtility.FromJson<MoveCommandSample>( model.message ); if (command.target == gameObject.name) { transform.position += Vector3.right * command.offset; } }
IEnumerator SyncRoutine() { while (true) { PhotonRPCModel model = new PhotonRPCModel(); model.command = PhotonRPCCommand.StartSync; model.senderId = gameObject.name; PhotonRPCHandler.GetInstance().PostRPC(model); yield return new WaitForSeconds(3.0f); } }
void move(string id, float x, float z) { if (death[int.Parse(id)] == false) { sampleCommand.target = id; sampleCommand.offsetX = x; sampleCommand.offsetZ = z; PhotonRPCModel model = new PhotonRPCModel(); model.senderId = PlayerID; model.command = PhotonRPCCommand.Move; model.message = JsonUtility.ToJson(sampleCommand); PhotonRPCHandler.GetInstance().PostRPC(model); } }
public void SceneChange() { GetComponent<Button>().interactable = false; GameManager.GetInstance().LoadScene(mSceneName); if (GameManager.GetInstance().myInfo.isHost) { PhotonRPCModel model = new PhotonRPCModel(); model.senderId = GameManager.GetInstance().myInfo.id.ToString(); model.command = PhotonRPCCommand.Departure; model.message = mSceneName; PhotonRPCHandler.GetInstance().PostRPC(model); } }
public void Departure() { if (GameManager.GetInstance().myInfo.isHost) { var list = GameManager.GetInstance().ReadyStatusList.readyStatusList; foreach (var val in list) { val.info.isHuman = true; } list[Random.Range(0, list.Count)].info.isHuman = false; GameManager.GetInstance().PostUpdateReadyRPC(); PhotonRPCModel model = new PhotonRPCModel(); model.senderId = GameManager.GetInstance().myInfo.id.ToString(); model.command = PhotonRPCCommand.Departure; model.message = ""; PhotonRPCHandler.GetInstance().PostRPC(model); } GameManager.GetInstance().LoadScene("Field"); }
// Use this for initialization void Start () { //SetCharaCos(1, 1, 1, 1, 1, 1, 1); CharactorCos characterCos = new CharactorCos(); characterCos.HeadIndex = Random.Range (0, Head.Length); characterCos.EyeIndex = Random.Range (0, Eye.Length); characterCos.BodyIndex = Random.Range(0, Body.Length); characterCos.UarmIndex = Random.Range (0, Uarm.Length); characterCos.BarmIndex = Random.Range (0, Barm.Length); characterCos.LegIndex = Random.Range (0, Leg.Length); characterCos.WeponIndex = Random.Range (0, Wepon.Length); SetCharaCos (characterCos); PhotonRPCModel model = new PhotonRPCModel (); model.senderId = GameManager.GetInstance ().myInfo.id.ToString(); model.command = PhotonRPCCommand.Costume; CostumeCommand command = new CostumeCommand (); command.target = model.senderId; command.characotorCostume = characterCos; model.message = JsonUtility.ToJson(command); PhotonRPCHandler.GetInstance().PostRPC(model); }
private void MoveEvent(PhotonRPCModel model) { MoveCommand command = JsonUtility.FromJson<MoveCommand>(model.message); if (command.target == gameObject.name) { Vector3 pos; pos = transform.position; pos += Vector3.right * command.offsetX; pos += Vector3.forward * command.offsetZ; if (command.offsetX < 0) { if (this.transform.position.x > 0) { search(pos, command); } } if (command.offsetX > 0) { if (this.transform.position.x < stage.row - 1) { search(pos, command); } } if (command.offsetZ < 0) { if (this.transform.position.z > 0) { search(pos, command); } } if (command.offsetZ > 0) { if (this.transform.position.z < stage.col - 1) { search(pos, command); } } } }
private static void OnMoveEvent(PhotonRPCModel model) { moveEvent(model); }
private static void OnTimeOverEvent(PhotonRPCModel model) { timeOverEvent(model); }
public void PostRPC(PhotonRPCModel model) { photonView.RPC("HandleRPC", PhotonTargets.All, JsonUtility.ToJson(model)); }
private static void OnStartBattleEvent(PhotonRPCModel model){ startBattleEvent(model); }
private static void OnSyncGameRemainTimeEvent(PhotonRPCModel model){ syncGameRemainTimeEvent(model); }
private static void OnCostumeEvent(PhotonRPCModel model) { costumeEvent (model); }
private static void OnActionTickerEvent(PhotonRPCModel model){ if(actionTickerEvent != null){ actionTickerEvent(model); } }
private static void OnSyncPosition(PhotonRPCModel model) { if (syncPositionEvent != null) { syncPositionEvent(model); } }
private static void OnDepartureEvent(PhotonRPCModel model) { departureEvent(model); }
private void SyncGameRemainTime(PhotonRPCModel model) { gameRemainTime = float.Parse(model.message); }
/// <summary> /// 時間切れで次に遷移するかもしれない /// </summary> /// <param name="model"></param> public void OnTimeOver(PhotonRPCModel model) { LoadScene("Field"); roundCount--; if (roundCount == 0) { //最終リザルト } else { //ラウンドリザルト } }
private static void OnUpdateReady(PhotonRPCModel model) { updateReadyEvent(model); }
private static void OnKillTimeEvent(PhotonRPCModel model) { killtimeEvent(model); }
void OnGUI() { GUILayout.BeginHorizontal(); { GUILayout.BeginVertical(); { MoveCommandSample sampleCommand = new MoveCommandSample(); if (GUILayout.Button("Right 1")) { sampleCommand.target = "1"; sampleCommand.offset = 1f; PhotonRPCModel model = new PhotonRPCModel(); model.senderId = "AAA"; model.command = PhotonRPCCommand.Move; model.message = JsonUtility.ToJson(sampleCommand); GetComponent<PhotonRPCHandler>().PostRPC(model); } if (GUILayout.Button("Right 2")) { sampleCommand.target = "2"; sampleCommand.offset = 1f; PhotonRPCModel model = new PhotonRPCModel(); model.senderId = "AAA"; model.command = PhotonRPCCommand.Move; model.message = JsonUtility.ToJson(sampleCommand); GetComponent<PhotonRPCHandler>().PostRPC(model); } if (GUILayout.Button("Right 3")) { sampleCommand.target = "3"; sampleCommand.offset = 1f; PhotonRPCModel model = new PhotonRPCModel(); model.senderId = "AAA"; model.command = PhotonRPCCommand.Move; model.message = JsonUtility.ToJson(sampleCommand); GetComponent<PhotonRPCHandler>().PostRPC(model); } } GUILayout.EndVertical(); GUILayout.BeginVertical(); { KillCommandSample sampleCommand = new KillCommandSample(); if (GUILayout.Button("Kill 1")) { sampleCommand.target = "1"; PhotonRPCModel model = new PhotonRPCModel(); model.senderId = "AAA"; model.command = PhotonRPCCommand.Kill; model.message = JsonUtility.ToJson(sampleCommand); GetComponent<PhotonRPCHandler>().PostRPC(model); } if (GUILayout.Button("Kill 2")) { sampleCommand.target = "2"; PhotonRPCModel model = new PhotonRPCModel(); model.senderId = "AAA"; model.command = PhotonRPCCommand.Kill; model.message = JsonUtility.ToJson(sampleCommand); GetComponent<PhotonRPCHandler>().PostRPC(model); } if (GUILayout.Button("Kill 3")) { sampleCommand.target = "3"; PhotonRPCModel model = new PhotonRPCModel(); model.senderId = "AAA"; model.command = PhotonRPCCommand.Kill; model.message = JsonUtility.ToJson(sampleCommand); GetComponent<PhotonRPCHandler>().PostRPC(model); } } GUILayout.EndVertical(); } GUILayout.EndHorizontal(); }
private static void OnJoinEvent(PhotonRPCModel model) { joinEvent(model); }
private void CallTimeOver() { PhotonRPCModel model = new PhotonRPCModel(); model.command = PhotonRPCCommand.TimeOver; PhotonRPCHandler.GetInstance().PostRPC(model); }
private static void OnStartSync(PhotonRPCModel model) { if (startSyncEvent != null) { startSyncEvent(model); } }
private void OnStartBattleEvent(PhotonRPCModel model) { startedGame = true; }