Increased levels of mine

This commit is contained in:
Sewmina
2022-10-10 20:42:54 +05:30
parent 14d0666397
commit 75cba445c7
3 changed files with 73 additions and 66 deletions

View File

@@ -4,32 +4,32 @@ using UnityEngine;
public class GoldMine : MonoBehaviour
{
static int LevelsCount = 40;
void Start()
{
for(int i=0; i < 9; i++){
for(int i=0; i < LevelsCount * LevelsCount; i++){
int l = i+1;
int p = GetProductionRateByLevel(l);
int c = GetCapacityRateByLevel(l);
int L = GetLevelByRates(c,p);
Debug.Log($"Level:{L} ,Prod:{p}, Capactiy:{c}");
Debug.Log($"Level:{l},{L} ,Prod:{p}, Capactiy:{c}");
}
}
//Note for future me: Refer to the sketch you draw on laptop to understand below equations
public static int GetProductionRateByLevel(int level){
//P = L - C - (2l-3)
int l = Mathf.CeilToInt((float)level/3f);
int l = Mathf.CeilToInt((float)level/(float)LevelsCount);
return l;
}
public static int GetCapacityRateByLevel(int level){
//C = L -3(l - 1)
int l = Mathf.CeilToInt((float)level/3f);
return level - 3 * (l - 1);
int l = Mathf.CeilToInt((float)level/(float)LevelsCount);
return level - LevelsCount * (l - 1);
}
public static int GetLevelByRates(int Capacity, int Production){
//L = 3P + C -3
return (3*Production) + Capacity - 3;
return (LevelsCount*Production) + Capacity - LevelsCount;
}
}