public bool checkAvailablePos(Vector2 pos) { QTEController qte = FindObjectOfType <QTEController>(); if (!qte) { Debug.LogError("ERROR: QTEController not in the scene."); return(true); } foreach (GameObject go in qte.activeQTEs) { QTEMother qtemom = go.GetComponent <QTEMother>(); if (qtemom is QTEClick click) { if (!checkProperDistance(click.transform.position, pos)) { return(false); } } else if (qtemom is QTETouch touch) { if (!checkProperDistance(touch.transform.position, pos)) { return(false); } } else if (qtemom is QTESlider slide) { BezierCurve curve = qtemom.gameObject.GetComponent <BezierCurve>(); foreach (Vector2 v2 in curve.positions) { if (!checkProperDistance(pos, v2)) { return(false); } } } } return(true); }
public void ValidateAQTE(QTEMother qt, QTEMother.ValidationType type) { switch (type) { case QTEMother.ValidationType.PERFECT: if (GameController.activeGC.selectedDifficulty != GameController.Gametype.TRAINING) { score += givenScore; timeLeft += givenPerfect; } dingding.Play(); activeGift.ReduceQte(); break; case QTEMother.ValidationType.GOOD: if (GameController.activeGC.selectedDifficulty != GameController.Gametype.TRAINING) { score += givenScore / 2; timeLeft += givenGood; } dingding.Play(); activeGift.ReduceQte(); break; case QTEMother.ValidationType.FAIL: if (GameController.activeGC.selectedDifficulty != GameController.Gametype.TRAINING) { timeLeft -= 2f; } error.Play(); break; } activeQTEs.Remove(qt.gameObject); Destroy(qt.gameObject); }