コード例 #1
0
 public void RemoveItem(Item item)
 {
     // Remove the item from the world at the specified location.
     Logger.DebugFormat("Removing {0} qty {1} id {2}", item.Name, item.Count, item.Id);
     NotifyNearbyAoiDeparture(item);
     EntityTree.Remove(item);
     Objects.Remove(item);
 }
コード例 #2
0
 public void RemoveGold(Gold gold)
 {
     // Remove the gold from the world at the specified location.
     Logger.DebugFormat("Removing {0} qty {1} id {2}", gold.Name, gold.Amount, gold.Id);
     NotifyNearbyAoiDeparture(gold);
     EntityTree.Remove(gold);
     Objects.Remove(gold);
 }
コード例 #3
0
 public void RemoveItem(ItemObject itemObject)
 {
     // Remove the ItemObject from the world at the specified location.
     GameLog.DebugFormat("Removing {0} qty {1} id {2}", itemObject.Name, itemObject.Count, itemObject.Id);
     NotifyNearbyAoiDeparture(itemObject);
     lock (_lock)
     {
         EntityTree.Remove(itemObject);
         Objects.Remove(itemObject);
     }
 }
コード例 #4
0
ファイル: Map.cs プロジェクト: bigspoondude/server
        public void Remove(VisibleObject obj)
        {
            lock (_lock)
            {
                if (Objects.Remove(obj))
                {
                    EntityTree.Remove(obj);

                    if (obj is User)
                    {
                        var user = obj as User;
                        Users.Remove(user.Name);
                        if (user.ActiveExchange != null)
                        {
                            user.ActiveExchange.CancelExchange(user);
                        }
                    }

                    var affectedObjects = EntityTree.GetObjects(obj.GetViewport());

                    foreach (var target in affectedObjects)
                    {
                        // If the target of a Remove is a player, we insert a 250ms delay to allow the animation
                        // frame to complete, or a slight delay to allow a kill animation to finish animating.
                        // Yes, this is a thing we do.
                        if (target is User && obj is User)
                        {
                            ((User)target).AoiDeparture(obj, 250);
                        }
                        else if (target is User && obj is Creature)
                        {
                            ((User)target).AoiDeparture(obj, 100);
                        }
                        else
                        {
                            target.AoiDeparture(obj);
                        }

                        obj.AoiDeparture(target);
                    }

                    obj.Map = null;
                }
                else
                {
                    GameLog.Fatal("Failed to remove gameobject id: {0} name: {1}", obj.Id, obj.Name);
                }
            }
        }
コード例 #5
0
        public void Remove(VisibleObject obj)
        {
            if (Objects.Remove(obj))
            {
                EntityTree.Remove(obj);

                if (obj is User)
                {
                    var user = obj as User;
                    Users.Remove(user.Name);
                    if (user.ActiveExchange != null)
                    {
                        user.ActiveExchange.CancelExchange(user);
                    }
                }

                var affectedObjects = EntityTree.GetObjects(obj.GetViewport());

                foreach (var target in affectedObjects)
                {
                    // If the target of a Remove is a player, we insert a 250ms delay to allow the animation
                    // frame to complete.
                    if (target is User)
                    {
                        ((User)target).AoiDeparture(obj, 250);
                    }
                    else
                    {
                        target.AoiDeparture(obj);
                    }

                    obj.AoiDeparture(target);
                }

                obj.Map = null;
                obj.X   = 0;
                obj.Y   = 0;
            }
        }