using System;
using System.Drawing;

namespace Icarus.Logic.Physics
{
	/// <summary>
	/// Summary description for PhysicsFootball.
	/// </summary>
	public class PhysicsFootball : PhysicsPlayer
	{
		public PhysicsFootball()
		{
			this.BounceCoeffecient = .5f;
		}

        protected override int collideWithPO(PhysicsObject po, Point pntCollision)
        {
            return (int)PhysicsSettings.enumActions.DoNothing;
        }

        protected override void collideWithMask(Point collision)
        {
            Bitmap mask = PhysicsEngine.Instance.CollisionMask;
            Color cCollision = mask.GetPixel((int)collision.x, (int)collision.y);

            //Hit the floor/roof
            if(RGBCompare(cCollision, PhysicsSettings.Instance.Black))
            {
                this.Velocity.j *= (-1f * this.BounceCoeffecient);
                this.collidesWithMask();
            }
                //Hit wall
            else if(RGBCompare(cCollision, PhysicsSettings.Instance.Red))
            {
                this.Velocity.i *= (-1f * this.BounceCoeffecient);
                this.collidesWithMask();
            }
                //Hit positive slope
            else if(RGBCompare(cCollision, PhysicsSettings.Instance.Green))
            {

                Physics.Vector.ScalarMultVector(this.Velocity, this.Velocity, 0);

            }
                //Hit negative slope
            else if(RGBCompare(cCollision, PhysicsSettings.Instance.Blue))
            {
                Physics.Vector.ScalarMultVector(this.Velocity, this.Velocity, 0);
            }
            else
            {
                this.Velocity.i = 0;
                this.Velocity.j = 0;
                this.Velocity.k = 0;
            }
        }

	}
}
