/// <summary>Add an object to our surface</summary>
        /// <param name="newObject">The (PhysicalObject) that we want to add</param>
        /// <param name="startingPosition">The (Point) where the object should originate</param>
        /// <returns>(Boolean) Could the object be added?</returns>
        public Boolean AddObject(PhysicalObject newObject, Point startingPosition)
        {
            if (!this.LocationAvailable(startingPosition))
            {
                return(false);
            }

            this.Objects.Add(newObject, startingPosition);
            return(true);
        }
Exemplo n.º 2
0
        /// <summary>Add an object to our surface</summary>
        /// <param name="newObject">The (PhysicalObject) that we want to add</param>
        /// <param name="startingPosition">The (Point) where the object should originate</param>
        /// <returns>(Boolean) Could the object be added?</returns>
        public Boolean AddObject(PhysicalObject newObject, Point startingPosition)
        {
            if (!this.LocationAvailable(startingPosition))
            {
                return false;
            }

            this.Objects.Add(newObject, startingPosition);
            return true;
        }
 /// <summary>Get the position of an object on the surface</summary>
 /// <param name="testObject">The (PhysicalObject) that we want to find.</param>
 /// <returns>The (Point) where the object is currently located.</returns>
 public Point GetPosition(PhysicalObject testObject)
 {
     if (this.Objects != null && this.Objects.ContainsKey(testObject))
     {
         return(this.Objects[testObject]);
     }
     else
     {
         throw new System.ArgumentOutOfRangeException("testObject", "The specified object is not on this surface.");
     }
 }
Exemplo n.º 4
0
 /// <summary>Get the position of an object on the surface</summary>
 /// <param name="testObject">The (PhysicalObject) that we want to find.</param>
 /// <returns>The (Point) where the object is currently located.</returns>
 public Point GetPosition(PhysicalObject testObject)
 {
     if (this.Objects != null && this.Objects.ContainsKey(testObject))
     {
         return this.Objects[testObject];
     }
     else
     {
         throw new System.ArgumentOutOfRangeException("testObject", "The specified object is not on this surface.");
     }
 }
        /// <summary>Attempt to move an object to a new position on this surface</summary>
        /// <param name="testObject">The (PhysicalObject) that we want to move.</param>
        /// <param name="newPosition">The (Point) that we want to move it to.</param>
        /// <returns>(Boolean) Was the move successful?</returns>
        public Boolean MoveObject(PhysicalObject testObject, Point newPosition)
        {
            if (!this.LocationAvailable(newPosition))
            {
                return(false);
            }

            if (!this.Objects.ContainsKey(testObject))
            {
                throw new System.ArgumentOutOfRangeException("testObject", "The specified object is not on this surface.");
            }
            else
            {
                this.Objects[testObject] = newPosition;
                return(true);
            }
        }
Exemplo n.º 6
0
        /// <summary>Attempt to move an object to a new position on this surface</summary>
        /// <param name="testObject">The (PhysicalObject) that we want to move.</param>
        /// <param name="newPosition">The (Point) that we want to move it to.</param>
        /// <returns>(Boolean) Was the move successful?</returns>
        public Boolean MoveObject(PhysicalObject testObject, Point newPosition)
        {
            if (!this.LocationAvailable(newPosition))
            {
                return false;
            }

            if (!this.Objects.ContainsKey(testObject))
            {
                throw new System.ArgumentOutOfRangeException("testObject", "The specified object is not on this surface.");
            }
            else
            {
                this.Objects[testObject] = newPosition;
                return true;
            }
        }