Пример #1
0
 /// <summary>
 /// Initializes a new instance of the TransferOperator class.
 /// </summary>
 public TransferOperator(WorldObject objectToMove)
 {
     _objectToMove = objectToMove;
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the PutOperator class.
 /// </summary>
 /// <param name="avatar">The avatar performing the action</param>
 /// <param name="objectToMove">The object that will be moved</param>
 public PutOperator(Avatar avatar, WorldObject objectToMove)
 {
     _avatar = avatar;
     _objectToMove = objectToMove;
 }
Пример #3
0
 /// <summary>
 /// Transfers an object from its parent container to this one.
 /// Used internally by domain objects to maintain proper state.
 /// </summary>
 /// <param name="objectToTransfer">The object to transfer into this container</param>
 /// <remarks>
 /// As this operation can really make a mess of the domain state, it is not accessible outside the domain assembly
 /// </remarks>
 internal TransferOperator Transfer(WorldObject objectToTransfer)
 {
     return new TransferOperator(objectToTransfer);
 }
 /// <summary>
 /// Adds a single object
 /// </summary>
 /// <param name="objectToAdd">The object to add</param>
 public void AddObject(WorldObject objectToAdd)
 {
     if (objectToAdd.Size > StorageCapacityRemaining)
     {
         throw new CapacityException(string.Format("The supplied item was '{0}' in size, but there was only '{1}' left to store it.", objectToAdd.Size, StorageCapacityRemaining));
     }
     _contents.Add(objectToAdd);
 }