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); } } }
public void charge(float deltaChargeTime) { chargeTime += deltaChargeTime; sba.processHoldGesture(transform.position, chargeTime, false); }
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); } } } }