Exemple #1
0
        /// <summary>
        /// Response mouse left button down.
        /// </summary>
        protected virtual void OnMouseDown()
        {
            if (!isEnable)
            {
                return;
            }

            IsDown        = true;
            currentOffset = downOffset;
            TranslateButton(currentOffset);

            if (useLED)
            {
                led.Open();
            }

            if (OnSwitchDown != null)
            {
                OnSwitchDown.Invoke();
            }
        }
Exemple #2
0
    // 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();
        }
    }