123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using ObjectScripts;
- namespace UIScripts
- {
- public class ControlButtons : MonoBehaviour
- {
- ///<summary>
- /// AbstractManager to control
- ///</summary>
- [SerializeField] AbstractManager ManagerObject;
- ///<summary>
- /// Text in the scene for the velocity.
- ///</summary>
- [SerializeField] UnityEngine.UI.Text VelocityText;
- private void Update()
- {
- //Set Text in Scene
- SetVelocityText(ManagerObject.GameVelocity, ManagerObject.forward);
- }
- ///<summary>
- /// On playbutton pressed
- ///</summary>
- public void PlayPressed()
- {
- ManagerObject.PlayPressed();
- }
- ///<summary>
- /// Sets the velocity text in the scene
- ///</summary>
- private void SetVelocityText(float vel, bool forward)
- {
- if (forward)
- VelocityText.text = vel.ToString();
- else
- VelocityText.text = "-" + vel.ToString();
- }
- ///<summary>
- /// On stopbutton pressed
- ///</summary>
- public void StopPressed()
- {
- ManagerObject.StopPressed();
- }
- ///<summary>
- /// On reversebutton pressed
- ///</summary>
- public void ReversePressed()
- {
- ManagerObject.ReversePressed();
- }
- ///<summary>
- /// On playbutton pressed
- ///</summary>
- public void PlusPressed()
- {
- ManagerObject.PlusPressed();
- }
- ///<summary>
- /// on minusbutton pressed
- ///</summary>
- public void MinusPressed()
- {
- ManagerObject.MinusPressed();
- }
- }
- }
|