protected override void HandleRequest(C2Request request) { string type = request.Type; NetworkPlayer player = (NetworkPlayer)request.getData("NetworkPlayer"); switch (type){ case C2MessageType.Request_UpdateCoin: playerList[player].updatePlayerCoin(); break; case C2MessageType.Request_UpdateEnergy: playerList[player].updatePlayerEnergy(); break; case C2MessageType.Request_UpdateSpeed: playerList[player].updatePlayerSpeed(); break; case C2MessageType.Request_UpdateShield: playerList[player].updatePlayerShield(); break; case C2MessageType.Request_UpdateAlive: playerList[player].updatePlayerAlive(); break; case C2MessageType.Request_PlayerStatus: C2Notification notification = new C2Notification(C2MessageType.Notification_PlayerStatus); notification.putData("NetworkPlayer" , player); notification.putData("Player" , playerList[player]); this.SendNotification(notification); break; default: break; } }
private void NotifyInput(float VInput , float HInput) { C2Notification notification = new C2Notification(C2MessageType.Notification_Input); notification.putData("VInput",VInput); notification.putData("HInput",HInput); this.SendNotification(notification); }
protected override void HandleRequest(C2Request request) { if (request.Type.Equals(C2MessageType.Request_ClientAction)){ C2Notification notification = new C2Notification(C2MessageType.Notification_Input); notification.putData("VInput", (float)request.getData("VInput")); notification.putData("HInput", (float)request.getData("HInput")); notification.putData("NetworkPlayer" , (NetworkPlayer)request.getData("NetworkPlayer")); this.SendNotification(notification); } }
protected void NotifyObstacleCollided(NetworkPlayer player , Type itemType) { C2Notification notification = new C2Notification("ObstacleCollided"); notification.putData("NetworkPlayer" , player); notification.MsgSrcType = itemType; this.SendNotification(notification); }
public void ItemPicked(string type , NetworkPlayer player) { if (player == Network.player){ C2Notification notification = new C2Notification(type); notification.putData("NetworkPlayer" , player); this.HandleNotification(notification); } }
public void GetPlayerStatus(NetworkPlayer player , int score , float distance , int coin , float energy , float speed , float shield, bool alive) { if (Network.player == player){ C2Notification notification = new C2Notification(C2MessageType.Notification_PlayerStatus); notification.putData("Player" , new Player(player , score , distance , coin , energy , speed , shield , alive)); this.HandleNotification(notification); } }
private void NotifyCrash(NetworkPlayer player) { C2Notification notification = new C2Notification(C2MessageType.Notification_EndGame); notification.putData("NetworkPlayer" , player); this.SendNotification(notification); }
private void NotifyItemPicked(NetworkPlayer player , string item) { C2Notification notification = new C2Notification(item + "Picked"); notification.putData("NetworkPlayer" , player); this.SendNotification(notification); }