public void SendAllClientsGoldPositionUpdate(Vector2Int newGoldPosition) { NWMGoldUpdate _goldUpdate = new NWMGoldUpdate(); _goldUpdate.posX = newGoldPosition.x; _goldUpdate.posZ = newGoldPosition.y; SendAllClientsMessage(host_id, reliable, _goldUpdate); }
public void ReceiveGoldPositionUpdate(NWMGoldUpdate goldUpdate) { network_GM.clientGoldManager.UpdateGoldPosition(goldUpdate.posX, goldUpdate.posZ); }
private void OnDataReceived(int channel_id, int host_id, NetworkMessage message) { switch (message.operation) { case NetworkOperation.none: break; case NetworkOperation.set_ready: break; case NetworkOperation.cart_data: NWMCartData cart_data = (NWMCartData)message; ReceiveCartData(cart_data); break; case NetworkOperation.grid_single: NWMGridData grid_data = (NWMGridData)message; ReceiveSingleGridData(grid_data); break; case NetworkOperation.user_counter: NWMUserCount user_counter = (NWMUserCount)message; ReceiveUserCount(user_counter); break; case NetworkOperation.scene_load: NWMSceneLoad scene_load = (NWMSceneLoad)message; ReceiveSceneToLoad(scene_load); break; case NetworkOperation.assign_num: NWMAssignPlayerNum assigner = (NWMAssignPlayerNum)message; player_id = assigner.num; Debug.Log(client_id); break; case NetworkOperation.gold_pos: NWMGoldUpdate goldUpdate = (NWMGoldUpdate)message; ReceiveGoldPositionUpdate(goldUpdate); break; case NetworkOperation.player_score: NWMScoreUpdate scoreUpdate = (NWMScoreUpdate)message; ReceiveScoreUpdate(scoreUpdate); break; case NetworkOperation.player_info: NWMPlayerIDUpdate idUpdate = (NWMPlayerIDUpdate)message; ReceivePlayerDataUpdate(idUpdate); break; case NetworkOperation.game_start: NWMGameStart start_msg = (NWMGameStart)message; SetClientGameStarted(start_msg); break; case NetworkOperation.player_respawn: NWMPlayerRespawn respawn_data = (NWMPlayerRespawn)message; ReceivePlayerRepsawnData(respawn_data); break; case NetworkOperation.timer_seconds: NWMTimerUpdate timer_data = (NWMTimerUpdate)message; ReceiveUpdateTimer(timer_data); break; case NetworkOperation.game_finished: NWMGameFinishedSendInfo game_finished_info = (NWMGameFinishedSendInfo)message; ReceiveGameFinishedInfo(game_finished_info); break; } }