using System;

namespace Icarus.Logic.Physics
{
	/// <summary>
	/// Summary description for RectangleWall.
	/// </summary>
	public class RectangleWall : PhysicsRectangle
	{
		public RectangleWall()
		{
			this.Description = "Rect-Wall";
		}


        /// <summary>
        /// Performs the necessary operations on a PO
        /// that has collided with this rectangle
        /// </summary>
        /// <param name="po">Physics Object that collided with rectangle</param>
        /// <returns>Action to be taken after collision occurs(ie: remove, doNothing)</returns>
        public override int intersectionAction(PhysicsObject po)
        {

            //Change to the new action state.
//            if(po.Velocity.i < 0)
//            {
//                po.ActionState = (int)PhysicsSettings.enumPlayerActionStates.StandingLeft;
//            }
//            else
//            {
//                po.ActionState = (int)PhysicsSettings.enumPlayerActionStates.StandingRight;
//            }
        
            //Stop movement
            po.Velocity.i = 0.0f;
           
            //Move the PO to the obj it collided with
            if((po.CollisionBox.BoundingBox.X+po.CollisionBox.BoundingBoxWidth/2) < (this.X+this.Width/2))//Move PO right
            {
                po.Location.x = this.X - po.CollisionBox.BoundingBoxWidth + po.CBXoffset;
            }
            else //Move PO left
            {
                po.Location.x = this.X + this.Width + po.CBXoffset;
            }

            return (int)PhysicsSettings.enumActions.DoNothing;
            //return (int)PhysicsSettings.enumActions.CheckAgain;

        }

	}
}
