using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.XR.Interaction.Toolkit; public class ContinuoslocomotionConfigurator : MonoBehaviour { public Button turnOffButton; public Button turnOnButton; public ContinuousMoveProviderBase locomotion; // Start is called before the first frame update void Start() { turnOnButton.onClick.AddListener(enableLocomotion); turnOffButton.onClick.AddListener(disableLocomotion); turnOffButton.gameObject.SetActive(false); // off by default } public void UpdateSpeed(float speed) { locomotion.moveSpeed = speed; } private void enableLocomotion() { locomotion.enabled = true; turnOnButton.gameObject.SetActive(false); turnOffButton.gameObject.SetActive(true); } private void disableLocomotion() { locomotion.enabled = false; turnOnButton.gameObject.SetActive(true); turnOffButton.gameObject.SetActive(false); } }