Ejemplo n.º 1
0
 public void CollisionTrigger(string playerId, int calculatedDamage)
 {
     try
     {
         IPlayer hitPlayer = GameHub.GetPlayerByPlayerId(playerId);
         hitPlayer.Tank.Health -= calculatedDamage;
         return;
     }
     catch (Exception e)
     {
         Clients.All.notEnoughClients(e);
     }
 }
Ejemplo n.º 2
0
 // Called upon a player decreasing their power.
 public void DecreasePower(string playerId)
 {
     try
     {
         // Hate this, oversight on my part led to a weird design
         IPlayer       player          = GameHub.GetPlayerByPlayerId(playerId);
         GameInstance  game            = GameHub.GetGameInstanceById(player.CurrentGameInstanceId);
         List <string> allExceptCaller = game.Players.Where(p => p.ConnectionId != Context.ConnectionId).Select(p => p.ConnectionId).ToList();
         Clients.Clients(allExceptCaller).decreasePower(playerId);
     }
     catch (Exception e)
     {
         Clients.All.notEnoughClients(e);
     }
 }