/// <summary> /// Delegate method called when hm's integrity reaches 0 /// </summary> private void shattered() { gm.switchGestureProfile("Rewind"); GameManager.playerShattered(); GameStatistics.incrementCounter("deathCount"); if (GameStatistics.counter("deathCount") == 1) { Vector2 lsrgp = GameManager.getLatestSafeRewindGhostPosition(); transform.position = ((Vector2)transform.position + lsrgp) / 2; EffectManager.highlightTapArea(lsrgp); } }
public void processTapGesture(Vector3 curMPWorld) { Debug.Log("GameManager.pTG: curMPWorld: " + curMPWorld); if (respawnTime > Time.time) { //If respawn timer is not over, don't do anything return; } GameState final = null; GameState prevFinal = null; foreach (GameState gs in gameStates) { if (gs.id != chosenId || playerObject.GetComponent <PlayerController>().isIntact()) {//don't include last game state if merky is shattered if (gs.checkRepresentation(curMPWorld)) { if (final == null || gs.id > final.id) //assuming the later ones have higher id values { prevFinal = final; //keep the second-to-latest one final = gs; //keep the latest one } } } } if (final != null) { if (final.id == chosenId) { if (prevFinal != null) {//if the current one overlaps a previous one, choose the previous one Rewind(prevFinal.id); } else { Load(final.id); } } else { Rewind(final.id); } } else if (!playerObject.GetComponent <PlayerController>().isIntact()) { Rewind(chosenId - 1);//go back to the latest safe past merky } if (GameStatistics.counter("deathCount") == 1) { EffectManager.highlightTapArea(Vector2.zero, false); } gestureManager.switchGestureProfile("Main"); if (camCtr.getScalePointIndex() > CameraController.SCALEPOINT_DEFAULT) { //leave this zoom level even if no past merky was chosen camCtr.setScalePoint(CameraController.SCALEPOINT_DEFAULT); } if (gameManagerTapProcessed != null) { gameManagerTapProcessed(curMPWorld); } }