int ComputeScoreForOrgan(SingleTaskManager organ) { switch (organ.currTask) { case SingleTaskManager.TaskType.LESS_THAN: { return(10 - (int)(organ.GetAimPercent() / 10)); } case SingleTaskManager.TaskType.MORE_THAN: { return((int)(organ.GetAimPercent() / 10)); } case SingleTaskManager.TaskType.SCORE: { return((int)(organ.GetAimScore() / 20)); } default: { return(0); } } }
void GenerateTask(SingleTaskManager manager) { int taskTypeIndex = Random.Range(0, 3); switch (taskTypeIndex) { case 0: { int score = ComputeScoreForLevel(); manager.GenerateScoreTask(score); break; } case 1: { int percent = ComputeMoreThanForLevel(); manager.GenerateMoreThanTask(percent); break; } case 2: { int percent = ComputeLessThanForLevel(); manager.GenerateLessThanTask(percent); break; } } }
int ComputeClicksNeededFor(SingleTaskManager organ) { double result = 0.0f; if (organ.currTask == SingleTaskManager.TaskType.SCORE) { result = organ.GetAimScore() / SingleTaskManager.DEFAULT_DELTA; } else { float aimPercent = organ.GetAimPercent(); float currPercent = organ.health.GetCurrPercent(); if (organ.currTask == SingleTaskManager.TaskType.MORE_THAN) { if (currPercent >= aimPercent) { return(1); } result = (aimPercent - currPercent) / MAX_INCREASE_PERCENT_IMPACT; } else if (organ.currTask == SingleTaskManager.TaskType.LESS_THAN) { if (aimPercent >= currPercent) { return(1); } result = (currPercent - aimPercent) / MAX_DECREASE_PERCENT_IMPACT; } } result = System.Math.Round(result); return((int)result); }