using UnityEngine;
using System.Collections;
using Framework.Entities;
using Framework.ActorComponents;
using Framework.StatSystem;

public class MoveAction : CoreAction
{
    public Vector3 target;

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

public class StopAction : CoreAction
{
}

public class TurnAction : CoreAction
{
    public Vector3 target;

    public TurnAction(Vector3 target)
    {
        this.target = target;
    }
}

public class SimpleLegs : PhysicsMover
{
    public Stat moveSpeed = new Stat(1f);
    public float moveForce = 1f;
    public float stopForce = 1f;

    protected override void InnerAwake()
    {
        base.InnerAwake();
        AddActionHandler<MoveAction>(Move);
        AddActionHandler<StopAction>(Stop);
    }

    protected override void InnerUpdate()
    {
        base.InnerUpdate();
    }

    private void Move(MoveAction action)
    {
        MoveToward(action.target, moveSpeed * 1f, moveForce * 10f, new Vector3(1,0,1));
    }

    private void Stop(StopAction action)
    {
        Stop(stopForce * 10f, new Vector3(1,0,1));
    }
}
