using UnityEngine;
using System.Collections;
using Framework.Entities;
using Framework.Extensions;
using System.Linq;
using System.Collections.Generic;
using Framework.InteractionSystem;
using Framework.ActorComponents;

namespace Project.Player
{
    public class PlayerMover : PhysicsMover
    {
        public class MoveAction : CoreAction
        {
            public Vector3 moveVector;

            public MoveAction(Vector3 moveVector)
            {
                this.moveVector = moveVector;
            }
        }

        public float moveSpeed = 10f;
        public float moveForce = 10f;

        // Use this for initialization
        protected override void InnerAwake()
        {
            AddActionHandler<MoveAction>(UpdateMoveTarget);
        }

        // Update is called once per frame
        protected override void InnerUpdate()
        {

        }

        private void UpdateMoveTarget(MoveAction action)
        {
            MoveToward(this.transform.position + action.moveVector, this.moveSpeed, this.moveForce);
            //this.transform.position = new Vector3(this.transform.position.x, -0.5f, this.transform.position.z); 
        }
    }
}