void Start() { if (stomach == null) { stomach = gameObject.AddComponent <CowStomach>() as CowStomach; } }
public override bool perform(GameObject agent) { CowStomach cowStomach = (CowStomach)agent.GetComponent(typeof(CowStomach)); cowStomach.grassEaten += 10; Destroy(target.gameObject); finishedAction = true; return(true); }
public override bool perform(GameObject agent) { CowStomach bag = (CowStomach)agent.GetComponent(typeof(CowStomach)); if (bag.hasMilk()) { done = true; return(true); } done = true; return(false); }
public override bool perform(GameObject agent) { CowStomach stomach = (CowStomach)agent.GetComponent(typeof(CowStomach)); stomach.waterDrunk += 10; WaterTrough[] waters = (WaterTrough[])UnityEngine.GameObject.FindObjectsOfType(typeof(WaterTrough)); WaterTrough water = waters[0]; bool drank = water.takeDrink(); if (drank == false) { finishedAction = true; return(false); } finishedAction = true; return(true); }