void GemClicked(GemController oldGem) { //Debug.Log("GemClick"); oldGem.raycasted = true; //mark as part of the gems to destroy gemClick = WaitClick; //send clicks to waitin function while monitoring velocity gameVars.GemClicked(oldGem.dynamicGemType, gemsColors[oldGem.dynamicGemType]); //send gem type to score data gameVars.SetComboScore(); //start comboingScore oldGem.GetMeAndMySisters(); //destroy gems of the same color gameVars.Moves++; //add a move to the move counter }
public void GetMeAndMySisters(directions directionToIgnore = directions.neutral) { RaycastHit hitUp, hitDown, hitLeft, hitRight; if (directionToIgnore != directions.up && (Physics.Raycast(transform.position, Vector3.up, out hitUp, 1.3f))) { GemController gemC = hitUp.collider.gameObject.GetComponent <GemController>(); if (gemC != null && gemC.dynamicGemType == this.dynamicGemType && gemC.raycasted == false) { gemC.raycasted = true; gemC.GetMeAndMySisters(directions.down); } } if (directionToIgnore != directions.down && (Physics.Raycast(transform.position, Vector3.down, out hitDown, 1.3f))) { GemController gemC = hitDown.collider.gameObject.GetComponent <GemController>(); if (gemC != null && gemC.dynamicGemType == this.dynamicGemType && gemC.raycasted == false) { gemC.raycasted = true; gemC.GetMeAndMySisters(directions.up); } } if (directionToIgnore != directions.left && (Physics.Raycast(transform.position, Vector3.left, out hitLeft, 1.3f))) { GemController gemC = hitLeft.collider.gameObject.GetComponent <GemController>(); if (gemC != null && gemC.dynamicGemType == this.dynamicGemType && gemC.raycasted == false) { gemC.raycasted = true; gemC.GetMeAndMySisters(directions.right); } } if (directionToIgnore != directions.right && (Physics.Raycast(transform.position, Vector3.right, out hitRight, 1.3f))) { GemController gemC = hitRight.collider.gameObject.GetComponent <GemController>(); if (gemC != null && gemC.dynamicGemType == this.dynamicGemType && gemC.raycasted == false) { gemC.raycasted = true; gemC.GetMeAndMySisters(directions.left); } } if (gemDead != null) { gemDead(); } }
public void GemClicked(GemController oldGem) { //Debug.Log("Clicked : " + oldGem.name); //Debug.Log("last combo : " + lastCombo); oldGem.raycasted = true; //mark as part of the gems to destroy gemClick = WaitClick; //send clicks to waiting function while monitoring velocity //lastCombo = 1; comboStart = true; oldGem.GetMeAndMySisters();//destroy gems of the same color doUpdateStuff += MonitorLevelsVelocity; Moves++; }