Esempio n. 1
0
        public override Task OnDisconnected(bool stopCalled)
        {
            PlayerHub.RemovePlayer(
                GlobalHost.ConnectionManager.GetHubContext <PlayerHub>(),
                Context.ConnectionId);

            return(base.OnDisconnected(stopCalled));
        }
Esempio n. 2
0
        private void PerformCollision(Player player)
        {
            Player collisedPlayer = colliser.CheckCollision(GameEngine.Instance.Players.Values, player);

            if (collisedPlayer != null)
            {
                if (collisedPlayer.Radius > player.Radius)
                {
                    PlayerHub.RemovePlayer(context, player.Id);
                    collisedPlayer.Radius += player.Radius;
                    context.Clients.All.changePlayerRadius(collisedPlayer);
                }
                else
                {
                    PlayerHub.RemovePlayer(context, collisedPlayer.Id);
                    player.Radius += collisedPlayer.Radius;
                    context.Clients.All.changePlayerRadius(player);
                }
            }
        }