// Update is called once per frame void Update() { float dTime = Time.deltaTime; drainEnergy(GV.ANT_ENERGY_DECAY * dTime); if (energy / GV.ANT_ENERGY_MAX <= GV.PRCNT_ENRGY_THRESHHOLD && holding != null && !holding.isZero()) { //Debug.Log (energy/GV.ANT_ENERGY_MAX); eatResource(GV.UNIT_EAT_PER_SEC * dTime); } if ((int)transform.position.x == (int)goalSpot.x && (int)transform.position.y == (int)goalSpot.y) { FindNodeUnderAnt(); //so you've reached your goal, what next } switch (antMode) { case AntMode.Forage: break; case AntMode.Scout: ScoutUpdate(dTime); break; case AntMode.Wander: WanderTimeUpdate(dTime); break; } MoveTowardsGoal(dTime); }
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); } } }