public void processHoldGesture(Vector3 gpos, float holdTime, bool finished)
    {
        Debug.DrawLine(transform.position, transform.position + new Vector3(0, halfWidth, 0), Color.blue, 10);
        float reducedHoldTime = holdTime - gm.getHoldThreshold();

        //Check Shield Bubble
        if (sba.enabled && gestureOnPlayer(gpos))
        {
            if (fta.enabled)
            {
                fta.dropHoldGesture();
            }
            sba.processHoldGesture(gpos, reducedHoldTime, finished);
        }
        //Check Force Wave
        else if (fta.enabled)
        {
            if (sba.enabled)
            {
                sba.dropHoldGesture();
            }
            Vector3 newPos = gpos;
            if (finished)
            {
                fta.processHoldGesture(newPos, reducedHoldTime, finished);
            }
            else
            {
                fta.processHoldGesture(newPos, reducedHoldTime, finished);
            }
        }
        else
        {//neither force wave nor shield bubble are active, probably meant to tap
            if (finished)
            {
                gm.adjustHoldThreshold(holdTime);
                processTapGesture(gpos);
            }
        }
    }
Exemple #2
0
 public void trigger()
 {
     //Shield Orbs require to be at full capacity to deploy a shield
     if (sba.maxHoldTime <= chargeTime)
     {
         GameObject newSB;
         sba.processHoldGesture(transform.position, chargeTime, true, out newSB);
         if (newSB != null)
         {
             currentSB = newSB;
         }
         chargeTime = 0;
     }
     sba.dropHoldGesture();
 }
Exemple #3
0
    public void processHoldGesture(Vector3 gpos, float holdTime, bool finished)
    {
        Debug.DrawLine(transform.position, transform.position + new Vector3(0, halfWidth, 0), Color.blue, 10);
        float reducedHoldTime = holdTime - gm.getHoldThreshold();
        float gestureDistance = Vector3.Distance(gpos, transform.position);
        bool  processed       = false;//if it's not processed by an ability, it will be turned into a tap gesture

        //Check Shield Bubble
        if (sba.maxGestureRange >= gestureDistance)
        {
            if (fta.enabled)
            {
                fta.dropHoldGesture();
            }
            if (sba.enabled)
            {
                processed = true;
                tpa.dropHoldGesture();
                sba.processHoldGesture(gpos, reducedHoldTime, finished);
            }
            else
            {
                tpa.processHoldGesture(gpos, reducedHoldTime, finished);
            }
        }
        //Check Force Wave
        else if (fta.maxGestureRange >= gestureDistance)
        {
            if (sba.enabled)
            {
                sba.dropHoldGesture();
            }
            if (fta.enabled)
            {
                processed = true;
                tpa.dropHoldGesture();
                fta.processHoldGesture(gpos, reducedHoldTime, finished);
            }
            else
            {
                tpa.processHoldGesture(gpos, reducedHoldTime, finished);
            }
        }
        else
        {
            if (fta.enabled)
            {
                fta.dropHoldGesture();
            }
            if (sba.enabled)
            {
                sba.dropHoldGesture();
            }
            tpa.processHoldGesture(gpos, reducedHoldTime, finished);
        }
        if (!processed)
        {//neither force wave nor shield bubble are active, probably meant to tap
            if (finished)
            {
                processTapGesture(gpos);
                if (holdTime < tpa.maxHoldTime)
                {
                    gm.adjustHoldThreshold(holdTime);
                }
            }
        }
    }