public void OnUpdate() { if (Input.GetKeyUp(KeyCode.Plus) || Input.GetKeyUp(KeyCode.KeypadPlus)) { OnSpeedUp?.Invoke(); } if (Input.GetKeyUp(KeyCode.Minus) || Input.GetKeyUp(KeyCode.KeypadMinus)) { OnSpeedDown?.Invoke(); } if (Input.GetKeyUp(KeyCode.Space)) { OnSpeedPause?.Invoke(); } }
// Update is called once per frame void Update() { //Detecting input if (Input.GetButtonDown("Left")) { OnHorizontalInputDown?.Invoke(-1); } if (Input.GetButtonDown("Right")) { OnHorizontalInputDown?.Invoke(1); } if (Input.GetButtonDown("Speed")) { OnSpeedDown?.Invoke(); } if (Input.GetButtonUp("Speed")) { OnSpeedUp?.Invoke(); } if (Input.GetButtonDown("RotateLeft")) { OnRotateLeftDown?.Invoke(); } if (Input.GetButtonDown("RotateRight")) { OnRotateRightDown?.Invoke(); } if (Input.GetButtonDown("Switch")) { OnSwitchDown?.Invoke(); } }