﻿using UnityEngine;

namespace AGXUnity_RobotML.Scripts
{

  public class DisplayTorque : MonoBehaviour
  {
    public UnityEngine.UI.Slider sliderLeft;
    public UnityEngine.UI.Slider sliderRight;
    public UnityEngine.UI.Text text;
    public RobotAgent agent;
    public int actionNumber = 0;

    // Update is called once per frame
    void Update()
    {
      var action = agent.GetStoredActionBuffers().ContinuousActions[ actionNumber ];
      text.text = ( action * 1000 ).ToString();

      if ( action < 0f ) {
        sliderLeft.value = Mathf.Abs( action );
        sliderRight.value = 0f;
      }
      else {
        sliderRight.value = action;
        sliderLeft.value = 0f;
      }
    }
  }
}
