Exemplo n.º 1
0
    void Update()
    {
        #region INPUT
        if (!isStarred)
        {
#if UNITY_STANDALONE || UNITY_EDITOR
            if (Input.GetMouseButtonDown(0))
            {
                if (Camera.main.ScreenToWorldPoint(Input.mousePosition).y > yDownLimit.position.y)
                {
                    if (Input.mousePosition.x > Screen.width / 2)
                    {
                        InputRight?.Invoke();
                        RightToLeftWind();
                    }
                    else
                    {
                        InputLeft?.Invoke();
                        LeftToRightWind();
                    }
                }
            }
            if (Input.GetMouseButtonDown(1))
            {
                PowerUpButtonUsing();
            }
#endif
#if UNITY_IOS || UNITY_EDITOR || UNITY_ANDROID
            if (Input.touchCount > 0)
            {
                Touch touch = Input.GetTouch(0);
                if (Camera.main.ScreenToWorldPoint(touch.position).y > yDownLimit.position.y)
                {
                    if (touch.phase == TouchPhase.Began)
                    {
                        if (touch.position.x > Screen.width / 2)
                        {
                            InputRight?.Invoke();
                            RightToLeftWind();
                        }
                        else
                        {
                            InputLeft?.Invoke();
                            LeftToRightWind();
                        }
                    }
                }
            }
#endif
        }
        #endregion

        if (puActive)
        {
            t += Time.deltaTime;
            if (t >= puTimer /*&& canStopRocket*/)
            {
                if (localPu == PU.ROCKET)
                {
                    if (canStopRocket)
                    {
                        ClearPU();
                    }
                }
                else
                {
                    ClearPU();
                }
            }
        }
    }
Exemplo n.º 2
0
 private void InvokeInputLeft(InputAction.CallbackContext context)
 {
     InputLeft?.Invoke();
     IsPlayerMovingLeft = true;
 }