using ActionGame.GameArtifacts.Models.Characters;
using System;


namespace ActionGame.GameArtifacts.Operators
{
    public class ObjectMover
    {
        public enum Direction { Up, Down, Left, Right }
        private IMoveableObject moveableObject;

        public static readonly Double DEFAULT_PLAYER_VELOCITY = 4.5;
        public static readonly Double DEFAULT_PLAYER_ACCELERATION = 0.5;


        public ObjectMover(IMoveableObject moveableObject)
        {
            this.moveableObject = moveableObject;
        }


        public void Move(Direction direction)
        {
            Move(direction, DEFAULT_PLAYER_VELOCITY, DEFAULT_PLAYER_ACCELERATION);
        }


        public void Move(Direction direction, Double velocity, Double acceleration)
        {
            if (direction == Direction.Down)
            {
                moveableObject.MovementPhysics.VelocityY = velocity;
                moveableObject.MovementPhysics.AccelerationY = -acceleration;
            }
            else if (direction == Direction.Up)
            {
                moveableObject.MovementPhysics.VelocityY = -velocity;
                moveableObject.MovementPhysics.AccelerationY = acceleration;
            }
            else if (direction == Direction.Left)
            {
                moveableObject.MovementPhysics.VelocityX = -velocity;
                moveableObject.MovementPhysics.AccelerationX = acceleration;
            }
            else if (direction == Direction.Right)
            {
                moveableObject.MovementPhysics.VelocityX = velocity;
                moveableObject.MovementPhysics.AccelerationX = -acceleration;
            }
        }


    }
}
