Beispiel #1
0
    public void eatResource(float quantToEat)
    {
        resourceObject temp;

        if (holding.quantity > quantToEat)
        {
            holding.quantity -= quantToEat;
            temp              = new resourceObject(holding);
            temp.quantity     = quantToEat;
        }
        else
        {
            temp = new resourceObject(holding.give());
            refreshHoldingResource();
        }

        if (holding.isPoison)
        {
            takeDamage(temp.quantity * GV.POISON_TO_ENRGY);
        }
        else
        {
            addEnergy(temp.quantity * GV.RESOURCE_TO_ENRGY);
        }
    }
Beispiel #2
0
    public resourceObject give()
    {
        resourceObject temp = new resourceObject(this);

        zero();
        return(temp);
    }
Beispiel #3
0
    public resourceObject giveResource()
    {
        //pass the thing to ANT or colony
        resourceObject temp = new resourceObject(holding.give());

        refreshHoldingResource();
        return(temp);
    }
Beispiel #4
0
    public void takeResource(resourceObject resourceToHold, Transform foodLoc)
    {
        //Debug.Log ("Taking Resource;");
        holding = new resourceObject(resourceToHold);
        refreshHoldingResource();
        Vector2 varSaver = new Vector2(backtrackWeight, scoutingWeight);

        backtrackWeight = GV.BACK_PHER_WEIGHT_FOOD + Mathf.FloorToInt(GV.BACK_PHER_WEIGHT_ENRGY * energy);
        scoutingWeight  = 1;
        DropPheromone(foodLoc);
        backtrackWeight = (int)varSaver.x;
        scoutingWeight  = (int)varSaver.y;
    }
Beispiel #5
0
 public void addResource(resourceObject resObj)
 {
     if (!resObj.isZero())                                //if we are holding things
     {
         if (!resObj.isPoison)                            //if that thing is poisoned
         {
             if (resObj.resType == GV.ResourceTypes.Food) //ADD CORRESPONDING RESOURCE
             {
                 addFood(resObj.quantity);
             }
             else if (resObj.resType == GV.ResourceTypes.Water)
             {
                 addWater(resObj.quantity);
             }
             //Debug.Log ("Food/Water added: Col FOOD/WATER = " + foodStored + " " + waterStored);
         }
         else
         {
             antDeathFromPoison(resObj.quantity);
         }
     }
 }
Beispiel #6
0
 public resourceObject(resourceObject toCopy)
 {
     resType  = toCopy.resType;
     quantity = toCopy.quantity;
     isPoison = toCopy.isPoison;
 }
Beispiel #7
0
 public void takeResource(resourceObject resourceToHold)
 {
     //Debug.Log ("Taking Resource;");
     holding = new resourceObject(resourceToHold);
     refreshHoldingResource();
 }