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; } }
//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); }
/// <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); }
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; } }
/// <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)); }