public void SetImage() { if (ressources.GetSize() > 0) { if (ressources.foodCount == 0) { if (ressources.woodCount == 0) { spriteRenderer.sprite = stoneStack; } else if (ressources.stoneCount == 0) { spriteRenderer.sprite = woodStack; } else { spriteRenderer.sprite = mixedStacked; } } else { if (ressources.woodCount == 0 && ressources.stoneCount == 0) { spriteRenderer.sprite = foodStack; } else { spriteRenderer.sprite = mixedStacked; } } } }
public float RatioDoable() { int required = stockRequired.GetSize(); int totalRessource = Mathf.Min(stockCurrent.woodCount, stockRequired.woodCount) + Mathf.Min(stockCurrent.stoneCount, stockRequired.stoneCount) + Mathf.Min(stockCurrent.foodCount, stockRequired.foodCount); float ratio = totalRessource / required; return(ratio); }
public float MaxProdRatio() { int required = prod.GetSize(); if (required > 0) { int totalRessource = Mathf.Min(currentStock.woodCount, prod.woodCount) + Mathf.Min(currentStock.stoneCount, prod.stoneCount) + Mathf.Min(currentStock.foodCount, prod.foodCount); float ratio = totalRessource / required; return(ratio); } else { return(1f); } }
public ResourceStack AddRessources(ResourceStack _ajout) { ResourceStack surplus = carrying.AddWithinCapacity(_ajout, maxCarry); return(surplus); if (surplus.GetSize() > 0) { //GameState.instance.itemDrop.CreateRessourceStack() //return false; } else { //return true; } }