using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GamepadUI : MonoBehaviour
{
    const float ANALOG_DISTANCE = 30;
    const float BUTTON_DISTANCE = 14;

    public GameController.Half half;
    public RectTransform leftStick;
    public RectTransform rightStick;
    public RectTransform button;

    public int controlIndex = 0;

    private void Start() {
        half = controlIndex == 0 ? FindObjectOfType<GameController>().leftHalf : FindObjectOfType<GameController>().rightHalf;
    }

    // Update is called once per frame
    void Update()
    {
        leftStick.localPosition = half.leg.input * ANALOG_DISTANCE;
        rightStick.localPosition = half.arm.input * ANALOG_DISTANCE;
        button.localPosition = Vector3.down * half.pincher.value * BUTTON_DISTANCE;
    }
}
