Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
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;
     }
 }
Esempio n. 7
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;
     }
 }