Exemplo n.º 1
0
        public static IEquipment Unequip(
            this IEquipmentContainer container, IEquipment item, Option <Node> dropTo)
        {
            Ensure.That(container, nameof(container)).IsNotNull();
            Ensure.That(item, nameof(item)).IsNotNull();

            var parent = dropTo.IfNone(() => item.Node.GetTree().CurrentScene);

            Debug.Assert(parent != null, "parent != null");

            var transform = item.GetGlobalTransform();

            container.Remove(item);

            item.Configuration?.Deactivate();

            parent.AddChild(item.Node);

            item.SetGlobalTransform(transform);

            return(item);
        }