Ejemplo n.º 1
0
 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;
             }
         }
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
    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);
        }
    }
Ejemplo n.º 4
0
    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;
        }
    }