예제 #1
0
        public void SendAllEntities(NetworkClient Client)
        {
            var ESpawn = new Packets.SpawnPlayer();

            foreach (Entity e in Entities)
            {
                ESpawn.PlayerName = e.Name;
                ESpawn.PlayerID   = (sbyte)e.ClientID;
                ESpawn.X          = e.X;
                ESpawn.Y          = e.Y;
                ESpawn.Z          = e.Z;
                ESpawn.Yaw        = e.Rot;
                ESpawn.Pitch      = e.Look;

                if (e.MyClient != Client)
                {
                    ESpawn.Write(Client);
                }
                else
                {
                    ESpawn.PlayerID = (sbyte)-1;
                    ESpawn.Write(Client);
                }
            }
        }
예제 #2
0
        public void SpawnEntity(Entity ToSpawn)
        {
            var ESpawn = new Packets.SpawnPlayer();

            ESpawn.PlayerName = ToSpawn.Name;
            ESpawn.PlayerID   = (sbyte)ToSpawn.ClientID;
            ESpawn.X          = ToSpawn.X;
            ESpawn.Y          = ToSpawn.Y;
            ESpawn.Z          = ToSpawn.Z;
            ESpawn.Yaw        = ToSpawn.Rot;
            ESpawn.Pitch      = ToSpawn.Look;

            foreach (NetworkClient c in Clients)
            {
                if (c != ToSpawn.MyClient)
                {
                    ESpawn.Write(c);
                }
                else
                {
                    ESpawn.PlayerID = (sbyte)-1;
                    ESpawn.Write(c);
                    ESpawn.PlayerID = (sbyte)ToSpawn.ClientID;
                }
            }
        }