Exemple #1
0
        public void CreateCube(Vector3 position)
        {
            if (Cube != null)
            {
                Console.WriteLine($"Cube {Cube.id} should be destroyed");
                ServerSend.DestroyCube(0, Cube);
            }

            Cube = new Cube(ID, position);

            //foreach (Client client in Server.Clients.Values)
            //{
            //    if (client.player != null && client.ID != ID)
            //        ServerSend.CreateCube(client.Cube);
            //}

            Console.WriteLine($"Created Cube {Cube.id}");
            ServerSend.CreateCube(Cube);
        }
Exemple #2
0
        public void SendIntoGame(string playerName)
        {
            player = new Player(ID, playerName, Vector3.Zero);

            foreach (Client client in Server.Clients.Values)
            {
                if (client.player != null && client.ID != ID)
                {
                    ServerSend.SpawnPlayer(ID, client.player);
                    if (client.Cube != null)
                    {
                        ServerSend.CreateCube(ID, client.Cube);
                    }
                }
            }

            foreach (Client client in Server.Clients.Values)
            {
                if (client.player != null)
                {
                    ServerSend.SpawnPlayer(client.ID, player);
                }
            }
        }