//ACTUALIZA LA VELOCIDAD Y TIEMPO DE SALIDA (TBA) DE CADA MANZANA en cada llamada. void UpdateTBAandSpeed() { regulator.RegulateDifficulty(); //llamada a un metodo la clase que regula la dificultad para actualizar diff. Level difficultyLevel = manager.getDifficultyLevel(); switch (difficultyLevel) { case 1: Debug.Log("diff. 1"); timeBetweenApples = Random.Range(3f, 6f); manager.setAppleVelocity(2f); break; case 2: Debug.Log("diff. 2"); timeBetweenApples = timeBetweenApples = Random.Range(2f, 4f); manager.setAppleVelocity(3f); break; case 3: Debug.Log("diff. 3"); timeBetweenApples = timeBetweenApples = Random.Range(0f, 3f); manager.setAppleVelocity(3f); break; case 4: Debug.Log("diff. 4"); timeBetweenApples = timeBetweenApples = Random.Range(0f, 2f); manager.setAppleVelocity(4f); break; case 5: Debug.Log("diff. 5"); timeBetweenApples = timeBetweenApples = Random.Range(0f, 2f); manager.setAppleVelocity(5f); break; case 6: Debug.Log("diff. 6"); timeBetweenApples = timeBetweenApples = Random.Range(0f, 1.5f); manager.setAppleVelocity(5.5f); break; case 7: Debug.Log("diff. 7"); timeBetweenApples = timeBetweenApples = Random.Range(0f, 1f); manager.setAppleVelocity(7f); break; } }
public void RegulateDifficulty() { // totalApples = generator.getTotalApples(); Debug.Log(totalApples); if (temporalApples < 5) { temporalApples += 1; Debug.Log(temporalApples); } else { switch (manager.getDifficultyLevel()) { case 1: if (temporalFails < 1 && temporalHits >= 1) { increaseDiffLevel(); Debug.Log("incrementa"); } else { Debug.Log("No entinc " + totalApples * 10 / 100); } break; case 2: if (temporalFails > 0 && temporalHits < 3) { reduceDiffLevel(); Debug.Log("reduce"); } else if (temporalFails < 1 && temporalHits >= 2) { increaseDiffLevel(); Debug.Log("incrementa"); } else { Debug.Log("No entinc " + totalApples * 10 / 100); } break; case 3: if (temporalFails > 0 && temporalHits < 3) { reduceDiffLevel(); Debug.Log("reduce"); } else if (temporalFails < 1 && temporalHits >= 2) { increaseDiffLevel(); Debug.Log("incrementa"); } else { Debug.Log("No entinc " + totalApples * 10 / 100); } break; case 4: if (temporalFails > 0 && temporalHits < 3) { reduceDiffLevel(); Debug.Log("reduce"); } else if (temporalFails < 1 && temporalHits >= 3) { increaseDiffLevel(); Debug.Log("incrementa"); } else { Debug.Log("No entinc " + totalApples * 10 / 100); } break; default: Debug.Log("temporalfails " + temporalFails); if (temporalFails > 0 && temporalHits < 3) { reduceDiffLevel(); Debug.Log("reduce"); } else if (temporalFails < 1 && temporalHits >= 4) { increaseDiffLevel(); Debug.Log("incrementa"); } else { Debug.Log("Permanece"); } break; } temporalApples = 0; temporalFails = 0; temporalHits = 0; } }