Esempio n. 1
0
 public bool Tick(World world, RealmTime time)
 {
     remain -= time.thisTickTimes;
     if (remain < 1)
     {
         cb(world, time);
         return true;
     }
     return false;
 }
Esempio n. 2
0
 public void Oryx(World world, string text)
 {
     world.BroadcastPacket(new TextPacket()
     {
         BubbleTime = 0,
         Stars = -1,
         Name = "#Oryx the Mad God",
         Text = text
     }, null);
 }
Esempio n. 3
0
 //Null for player
 public static void AOE(World world, Entity self, float radius, bool players, Action<Entity> callback)
 {
     if (players)
         foreach (var i in world.PlayersCollision.HitTest(self.X, self.Y, radius))
         {
             var d = Dist(i, self);
             if (d < radius)
                 callback(i);
         }
     else
         foreach (var i in world.EnemiesCollision.HitTest(self.X, self.Y, radius))
         {
             if (!(i is Enemy)) continue;
             var d = Dist(i, self);
             if (d < radius)
                 callback(i);
         }
 }
Esempio n. 4
0
 //Null for player
 protected void AOE(World world, float radius, short? objType, Action<Entity> callback)
 {
     if (objType == null)
         foreach (var i in world.PlayersCollision.HitTest(Host.Self.X, Host.Self.Y, radius))
         {
             var d = Dist(i, Host.Self);
             if (d < radius)
                 callback(i);
         }
     else
         foreach (var i in world.EnemiesCollision.HitTest(Host.Self.X, Host.Self.Y, radius))
         {
             if (i.ObjectType != objType.Value) continue;
             var d = Dist(i, Host.Self);
             if (d < radius)
                 callback(i);
         }
 }
Esempio n. 5
0
 public static bool HasPlayerNearby(World world, double x, double y)
 {
     foreach (var i in world.PlayersCollision.HitTest(x, y, 16))
     {
         var d = Dist(i.X, i.Y, x, y);
         if (d < 16 * 16)
             return true;
     }
     return false;
 }
Esempio n. 6
0
 public static World AddWorld(World world)
 {
     world.Id = Interlocked.Increment(ref nextWorldId);
     Worlds[world.Id] = world;
     if (world is GameWorld)
         Monitor.WorldAdded(world);
     return world;
 }