using ActionGame.GameArtifacts.Models.Characters;
using Microsoft.Xna.Framework;
using System;


namespace ActionGame.GameArtifacts.Intelligence.NonPlayerCharacterMovement
{
    public class MirrorPlayerMovement : INonPlayerCharacterMovement
    {
        private ICharacter moveableObject;
        private TimeSpan lastMovementUpdate;
        private Player player;


        public MirrorPlayerMovement(ICharacter moveableObject, Player player)
        {
            this.moveableObject = moveableObject;
            this.player = player;
        }


        public void Act(GameTime gameTime)
        {
            if (lastMovementUpdate == null) lastMovementUpdate = gameTime.TotalGameTime;

            if ((gameTime.TotalGameTime - lastMovementUpdate).TotalSeconds > 0.10)
            {
                moveableObject.MovementPhysics.AccelerationX = player.MovementPhysics.AccelerationX * -1;
                moveableObject.MovementPhysics.AccelerationY = player.MovementPhysics.AccelerationY * -1;
                moveableObject.MovementPhysics.VelocityX = player.MovementPhysics.VelocityX * -1;
                moveableObject.MovementPhysics.VelocityY = player.MovementPhysics.VelocityY * -1;

                lastMovementUpdate = gameTime.TotalGameTime;
            }
        }


        public void PostMovementAct(GameTime gameTime)
        {

        }


    }
}
