//Method required to check if mobile buttons are pressed. private void RespondOnMobile() { UIButtonHandler BMobileThrustButton = BMobileThrust.GetComponent <UIButtonHandler> (); UIButtonHandler BMobileLeftButton = BMobileLeft.GetComponent <UIButtonHandler> (); UIButtonHandler BMobileRightButton = BMobileRight.GetComponent <UIButtonHandler> (); //Apply rotation in one direction or another depending of the button pressed. if (BMobileLeftButton.isButtonClicked()) { Rotate(-1); } else if (BMobileRightButton.isButtonClicked()) { Rotate(1); } //Apply thrust if button pressed. if (BMobileThrustButton.isButtonClicked()) { ApplyThrust(); } //If key is not pressed stop sounds and particles. else { audioSource.Stop(); mainEngineParticles.Stop(); } }
void Awake() { _button = GetComponent<UIButtonHandler>(); }
// Start is called before the first frame update void Start() { instance = this; }