Exemplo n.º 1
0
    /// <summary>
    /// Do the actual button action
    /// </summary>
    private void DoButton(TouchControllerButton button, Touch touch)
    {
        AssignButtonToFinger(touch.fingerId, button);
        button.Held();
        switch (button.type)
        {
        case TouchControllerButtonType.LEFT:
            x = -1 * xButtonValue;
            break;

        case TouchControllerButtonType.RIGHT:
            x = xButtonValue;
            break;

        case TouchControllerButtonType.UP:
            y = yButtonValue;
            break;

        case TouchControllerButtonType.DOWN:
            y = -1 * yButtonValue;
            break;

        case TouchControllerButtonType.JUMP:
            if (touch.phase == TouchPhase.Began)
            {
                jumpButtonDown = true;
            }
            jumpButtonHeld = true;
            break;

        case TouchControllerButtonType.RUN:
            if (allowRun)
            {
                running = true;
            }
            break;

        case TouchControllerButtonType.CHEAT:
            if (touch.phase == TouchPhase.Began)
            {
                GameObject.Find("GameController").GetComponent <GameManager>().toggle = !GameObject.Find("GameController").GetComponent <GameManager>().toggle;               // toggles onoff at each click
            }
            break;
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Do the actual button action
    /// </summary>
    private void DoButton(TouchControllerButton button, Touch touch)
    {
        AssignButtonToFinger(touch.fingerId, button);
        button.Held();
        switch (button.type)
        {
        case TouchControllerButtonType.LEFT:
            x = -1 * xButtonValue;
            break;

        case TouchControllerButtonType.RIGHT:
            x = xButtonValue;
            break;

        case TouchControllerButtonType.UP:
            y = yButtonValue;
            break;

        case TouchControllerButtonType.DOWN:
            y = -1 * yButtonValue;
            break;

        case TouchControllerButtonType.JUMP:
            if (touch.phase == TouchPhase.Began)
            {
                jumpButtonDown = true;
            }
            jumpButtonHeld = true;
            break;

        case TouchControllerButtonType.RUN:
            if (allowRun)
            {
                running = true;
            }
            break;
        }
    }
Exemplo n.º 3
0
	/// <summary>
	/// Do the actual button action
	/// </summary>
	private void DoButton(TouchControllerButton button, Touch touch) {
		AssignButtonToFinger (touch.fingerId, button);
		button.Held();
		switch (button.type) {
			case TouchControllerButtonType.LEFT:
				x = -1 * xButtonValue;
				break;
			case TouchControllerButtonType.RIGHT:
				x = xButtonValue;
				break;
			case TouchControllerButtonType.UP:
				y = yButtonValue;
				break;
			case TouchControllerButtonType.DOWN:
				y = -1 * yButtonValue;
				break;
			case TouchControllerButtonType.JUMP:
				if (touch.phase == TouchPhase.Began) {
					jumpButtonDown = true;
				}
				jumpButtonHeld = true;
				break;
			case TouchControllerButtonType.RUN:
				if (allowRun) running = true;
				break;
		}
	}
Exemplo n.º 4
0
 /// <summary>
 /// Do the actual button action
 /// </summary>
 private void DoButton(TouchControllerButton button, Touch touch)
 {
     AssignButtonToFinger (touch.fingerId, button);
     button.Held();
     switch (button.type) {
         case TouchControllerButtonType.LEFT:
             x = -1 * xButtonValue;
             break;
         case TouchControllerButtonType.RIGHT:
             x = xButtonValue;
             break;
         case TouchControllerButtonType.UP:
             y = yButtonValue;
             break;
         case TouchControllerButtonType.DOWN:
             y = -1 * yButtonValue;
             break;
         case TouchControllerButtonType.JUMP:
         if (touch.phase == TouchPhase.Began) {
                 jumpButtonDown = true;
             }
             jumpButtonHeld = true;
             break;
         case TouchControllerButtonType.RUN:
             if (allowRun) running = true;
             break;
         case TouchControllerButtonType.CHEAT:
             if (touch.phase == TouchPhase.Began)
             GameObject.Find("GameController").GetComponent<GameManager>().toggle = !GameObject.Find("GameController").GetComponent<GameManager>().toggle; // toggles onoff at each click
         break;
     }
 }