public void SwipeDetected(Vector3[] swipePositions)
    {
        if (paused)
        {
            return;
        }
        //Stubbed
        SwipeDirection dir = FindDirection(swipePositions);

        if (pmt.state == EnumPTrapezeState.OnTrapeze)
        {
            /*if ((dir != SwipeDirection.North && dir!=SwipeDirection.South) &&
             *  (Math.Abs(swipePositions[1].x - swipePositions[0].x) <= swipeShortDis))
             *  pmt.Short();
             * else
             *  pmt.Long();*/
            if (dir == SwipeDirection.East)
            {
                if (pmt.FacingRight())
                {
                    DoShort();
                }
                else
                {
                    DoLong();
                }
            }
            else if (dir == SwipeDirection.West)
            {
                if (pmt.FacingRight())
                {
                    DoLong();
                }
                else
                {
                    DoShort();
                }
            }
        }
        else if (pmt.state == EnumPTrapezeState.InAir)
        {
            trickManager.AddSwipe(dir);
        }
    }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     CalculateAngleDegrees();
     if (pm.state == EnumPTrapezeState.InAir && joint.connectedBody == null)
     {
         if (pm.head.transform.position.y > this.transform.position.y &&
             (pm.FacingRight() && pm.head.gameObject.transform.position.x < this.transform.position.x &&
              this.transform.position.x < pm.head.gameObject.transform.position.x + pm.grabTargetXRange) ||
             (!pm.FacingRight() && pm.head.gameObject.transform.position.x > this.transform.position.x &&
              this.transform.position.x > pm.head.gameObject.transform.position.x - pm.grabTargetXRange))
         {
             InRange(true);
         }
         else
         {
             InRange(false);
         }
         //InRange(true);
     }
     else
     {
         InRange(false);
     }
 }