Exemplo n.º 1
0
        private void AddClient(AirlockHostedClient client)
        {
            client.Network.Attach(WorldContent);

            Color color;

            if (Clients.Count == 0)
            {
                color = Color.Blue;
            }
            else if (Clients.Count == 1)
            {
                color = Color.Lime;
            }
            else if (Clients.Count == 2)
            {
                color = Color.Yellow;
            }
            else
            {
                color = Color.Red;
            }

            UnitPlayer player = new UnitPlayer(new Vector2(0, 0), color);

            client.SpawnPlayer(player);
            AddEntity(player);

            Clients.Add(client);
        }
Exemplo n.º 2
0
        private void DropClient(AirlockHostedClient client)
        {
            client.Close();

            if (client.Player != null)
            {
                RemoveEntity(client.Player);
            }

            Clients.Remove(client);
        }