示例#1
0
 public ServerClient(TcpClient client)
 {
     BufferSize = 0;
     Room       = null;
     zMessages  = new System.Collections.Concurrent.ConcurrentQueue <Message>();
     zSocket    = client;
     if (client != null)
     {
         zIP            = ((IPEndPoint)client.Client.RemoteEndPoint).Address.ToString();
         Hero           = new ClientHero();
         zReceiveThread = new Thread(new ThreadStart(Receive));
         zReceiveThread.IsBackground = true;
     }
     else
     {
         zId            = 0;
         zIP            = string.Empty;
         Hero           = null;
         zReceiveThread = null;
     }
 }
示例#2
0
 //messages send by server
 public void SendAddPlayer(ClientHero h)
 {
     SendMessage(MsgHeader.AddPlayer, h.Name, h.Netid, (char)h.Class, h.Position.X, h.Position.Y);
 }
示例#3
0
 //messages send by server
 public void SendAddPlayer(ClientHero h)
 {
     SendMessage(MsgHeader.AddPlayer, h.Name, h.Netid, (char)h.Class, h.Position.X, h.Position.Y);
 }
示例#4
0
 /// <summary>
 /// collision simulation because clienthero is not a shape to collide against
 /// </summary>
 /// <param name="c"></param>
 /// <param name="h"></param>
 /// <returns></returns>
 public bool Collide(DamageCircle c, ClientHero h)
 {
     return Vector3.DistanceSquared(c.Position, h.Position) <
         (c.Radius + HeroRadius) * (c.Radius + HeroRadius);
 }
示例#5
0
 public ServerClient(TcpClient client)
 {
     BufferSize = 0;
     Room = null;
     zMessages = new System.Collections.Concurrent.ConcurrentQueue<Message>();
     zSocket = client;
     if (client != null)
     {
         zIP = ((IPEndPoint)client.Client.RemoteEndPoint).Address.ToString();
         Hero = new ClientHero();
         zReceiveThread = new Thread(new ThreadStart(Receive));
         zReceiveThread.IsBackground = true;
     }
     else
     {
         zId = 0;
         zIP = string.Empty;
         Hero = null;
         zReceiveThread = null;
     }
 }
示例#6
0
 /// <summary>
 /// collision simulation because clienthero is not a shape to collide against
 /// </summary>
 /// <param name="c"></param>
 /// <param name="h"></param>
 /// <returns></returns>
 public bool Collide(DamageCircle c, ClientHero h)
 {
     return(Vector3.DistanceSquared(c.Position, h.Position) <
            (c.Radius + HeroRadius) * (c.Radius + HeroRadius));
 }