public DamageCircle(Hero heroOwner, Mob mobOwner, bool destroyOnHit, int id, MapRoom room) { Id = id; HeroOwner = heroOwner; MobOwner = mobOwner; DestroyOnHit = destroyOnHit; Room = room; ShapeManager.AddCircle(this); }
public DamageCircle AddCircle(Hero heroOwner, Mob mobOwner, TimeSpan lifeSpan, bool destroyOnHit, MapRoom room) { DamageCircle c = new DamageCircle(heroOwner, mobOwner, destroyOnHit, NextId++, room); Circles.Add(c); //remove event Globals.EventManager.AddEvent(delegate () { c.Destroy(); return 0; }, $"removecircle{NextId - 1}", false, lifeSpan, TimeSpan.Zero, TimeSpan.Zero); return c; }
public DamageCircle AddCircle(Hero heroOwner, Mob mobOwner, TimeSpan lifeSpan, bool destroyOnHit, MapRoom room) { DamageCircle c = new DamageCircle(heroOwner, mobOwner, destroyOnHit, NextId++, room); Circles.Add(c); //remove event Globals.EventManager.AddEvent(delegate() { c.Destroy(); return(0); }, $"removecircle{NextId - 1}", false, lifeSpan, TimeSpan.Zero, TimeSpan.Zero); return(c); }
public Mob SpawnMob(MobClass mobclas, MobMap map, Vector2 pos) { Mob m = Mob.MobServer(mobclas, map, pos); m.Position = new Vector3(pos, ZLayer.Npc); MapRoom room = Rooms[map]; room.Mobs.Add(m); m.Room = room; foreach (ServerClient c in room.Clients) { c.SendNewMob(m); } return(m); }
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; } }
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; } }