public void SwitchToggle()
 {
     isOn         = !isOn;
     myImg.sprite = isOn ? onSprite : offSprite;
     onToggle.Invoke(isOn);
     CrossPlatformInputManager.SetButtonDown("Dir");
     StartCoroutine("ResetDirButon");
 }
 // Normal button events
 void OnPowerButtonDown(GameObject sender)
 {
     if (sender == powerButton.gameObject && CrossPlatformInputManager.ButtonExists(powerButton.GetButtonName()))
     {
                         #if MOBILE_INPUT
         CrossPlatformInputManager.SetButtonDown(powerButton.GetButtonName());
                         #endif
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(keyboardButton))
     {
         CrossPlatformInputManager.SetButtonDown(crossplatformInputButtonName);
     }
     else if (Input.GetKeyUp(keyboardButton))
     {
         CrossPlatformInputManager.SetButtonUp(crossplatformInputButtonName);
     }
 }
예제 #4
0
 public void OnPointerDown(PointerEventData data)
 {
     CrossPlatformInputManager.SetButtonDown(ButtonName);
     BaseImage.gameObject.SetActive(true);
     BaseImage.position = data.position;
     mDragging          = true;
     mId = data.pointerId;
     if (Style != ControlStyle.Absolute)
     {
         mCenter = data.position;
     }
 }
예제 #5
0
 void DoSetButton()
 {
                 #if CROSS_PLATFORM_INPUT
     if (value.Value)
     {
         CrossPlatformInputManager.SetButtonUp(buttonName.Value);
     }
     else
     {
         CrossPlatformInputManager.SetButtonDown(buttonName.Value);
     }
                 #endif
 }
예제 #6
0
 public void SetDownState()
 {
     if (!isInUse)
     {
         CrossPlatformInputManager.SetButtonDown(Name);
         isInUse = true;
     }
     else
     {
         isInUse = false;
         CrossPlatformInputManager.SetButtonUp(Name);
     }
 }
예제 #7
0
 // Update is called once per frame
 void Update()
 {
     //Check if the left button is pressed
     lPressed = leftButton.GetComponent <LeftButtonScript>().getPressed();
     // If either button are pressed and the button is hovered over then set button to down
     if ((lPressed || pressed) && hover)
     {
         CrossPlatformInputManager.SetButtonDown(Name);
     }
     else
     {
         CrossPlatformInputManager.SetButtonUp(Name);
     }
 }
예제 #8
0
 private void Update()
 {
     //Debug.Log("Update " + joystick.Vertical + " " + _verticalAxisPressed + " " + _verticalAxisReset);
     if (joystick.Vertical <= 0)
     {
         _verticalAxisReset = true;
     }
     if (joystick.Vertical > 0 && !_verticalAxisPressed && _verticalAxisReset)
     {
         _verticalAxisPressed = true;
         _verticalAxisReset   = false;
         CrossPlatformInputManager.SetButtonDown("Jump");
     }
     CrossPlatformInputManager.SetAxis("Horizontal", joystick.Horizontal);
 }
예제 #9
0
    public void OnPointerDown(PointerEventData eventData)
    {
        if (_activated && !isOnTouch)
        {
            pointId = eventData.pointerId;

            axis.ResetAxis();
            axis.axisState = ETCAxis.AxisState.Down;

            isOnPress = false;
            isOnTouch = true;

            onDown.Invoke();
            ApllyState();
            axis.UpdateButton();
            // modified by cat heaven
            CrossPlatformInputManager.SetButtonDown(axis.unityAxis);
            // modified by cat heaven
        }
    }
예제 #10
0
        void NegVTriggerButtonDown(GameObject sender)
        {
            if (powerType == PowerType.Joystick)
            {
                if (sender == powerJoystick.gameObject && CrossPlatformInputManager.ButtonExists(powerJoystick.GetVNegButtonName()))
                {
                                        #if MOBILE_INPUT
                    CrossPlatformInputManager.SetButtonDown(powerJoystick.GetVNegButtonName());
                                        #endif
                }
            }

            if (powerType == PowerType.DPad)
            {
                if (sender == powerDPad.gameObject && CrossPlatformInputManager.ButtonExists(powerDPad.GetVNegButtonName()))
                {
                                        #if MOBILE_INPUT
                    CrossPlatformInputManager.SetButtonDown(powerDPad.GetVNegButtonName());
                                        #endif
                }
            }
        }
예제 #11
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            downPos = Input.mousePosition;
        }
        else if (Input.GetMouseButtonUp(0))
        {
            if (downPos != Vector3.zero)
            {
                Vector3 move = Input.mousePosition - downPos;
                if (Mathf.Abs(move.x) > Mathf.Abs(move.y))
                {
                    if (move.x > 0)
                    {
                        CrossPlatformInputManager.SetButtonDown(CrossPlatformInput.RIGHT);
                    }
                    else
                    {
                        CrossPlatformInputManager.SetButtonDown(CrossPlatformInput.LEFT);
                    }
                }
                else
                {
                    if (move.y > 0)
                    {
                        CrossPlatformInputManager.SetButtonDown(CrossPlatformInput.UP);
                    }
                    else
                    {
                        CrossPlatformInputManager.SetButtonDown(CrossPlatformInput.DOWN);
                    }
                }
            }

            downPos = Vector3.zero;
        }
    }
예제 #12
0
    void Update()
    {
        if (Input.GetKey("space"))
        {
            CrossPlatformInputManager.SetButtonDown("Jump");
        }
        else
        {
            CrossPlatformInputManager.SetButtonUp("Jump");
        }

        if (Input.GetKey("c"))
        {
            CrossPlatformInputManager.SetButtonDown("Sneak");
        }
        else
        {
            CrossPlatformInputManager.SetButtonUp("Sneak");
        }

        CrossPlatformInputManager.SetAxis("Horizontal", Input.GetAxis("Horizontal"));
        CrossPlatformInputManager.SetAxis("Vertical", Input.GetAxis("Vertical"));
    }
예제 #13
0
 // Update is called once per frame
 void Update()
 {
     if (Input.touchCount > 0)
     {
         if (Input.GetTouch(0).phase == TouchPhase.Began)
         {
             downPos = Input.GetTouch(0).position;
         }
         else if (Input.GetTouch(0).phase == TouchPhase.Ended)
         {
             Vector2 move = Input.GetTouch(0).position - downPos;
             if (Mathf.Abs(move.x) > Mathf.Abs(move.y))
             {
                 if (move.x > 0)
                 {
                     CrossPlatformInputManager.SetButtonDown(CrossPlatformInput.RIGHT);
                 }
                 else
                 {
                     CrossPlatformInputManager.SetButtonDown(CrossPlatformInput.LEFT);
                 }
             }
             else
             {
                 if (move.y > 0)
                 {
                     CrossPlatformInputManager.SetButtonDown(CrossPlatformInput.UP);
                 }
                 else
                 {
                     CrossPlatformInputManager.SetButtonDown(CrossPlatformInput.DOWN);
                 }
             }
         }
     }
 }
예제 #14
0
 //called by pressing the icon in the top left
 public void RemoveMorph()
 {
     //if (CrossPlatformInputManager.AxisExists ("Shake")) {
     CrossPlatformInputManager.SetButtonDown("Shake");
     //}
 }
예제 #15
0
 /// <summary>
 /// presses the endturn button down
 /// </summary>
 public void Button_End_Turn_Down()
 {
     CrossPlatformInputManager.SetButtonDown("endturn");
 }
예제 #16
0
 public void SetDownState()
 {
     CrossPlatformInputManager.SetButtonDown(Name);
 }
예제 #17
0
 public void OnPointerDown(PointerEventData eventData)
 {
     CrossPlatformInputManager.SetButtonDown(buttonName);
 }
예제 #18
0
 public void OnPointerDown(PointerEventData eventData)
 {
     print("down registered");
     CrossPlatformInputManager.SetButtonDown(Name);
 }
 public void Jump()
 {
     Debug.Log("in jump CustomControllerScript");
     CrossPlatformInputManager.SetButtonDown("Jump");
 }
예제 #20
0
 public void Attack()
 {
     SwingAudioSrc.Play();
     CrossPlatformInputManager.SetButtonDown("attack");
     CrossPlatformInputManager.SetButtonUp("attack");
 }
예제 #21
0
 public void OnColorChangeButtonPressed()
 {
     CrossPlatformInputManager.SetButtonDown("ColorChange");
     _colorChangeButtonPressed = true;
 }