Beispiel #1
0
 void Start()
 {
     if (stomach == null)
     {
         stomach = gameObject.AddComponent <CowStomach>() as CowStomach;
     }
 }
Beispiel #2
0
    public override bool perform(GameObject agent)
    {
        CowStomach cowStomach = (CowStomach)agent.GetComponent(typeof(CowStomach));

        cowStomach.grassEaten += 10;
        Destroy(target.gameObject);
        finishedAction = true;
        return(true);
    }
Beispiel #3
0
    public override bool perform(GameObject agent)
    {
        CowStomach bag = (CowStomach)agent.GetComponent(typeof(CowStomach));

        if (bag.hasMilk())
        {
            done = true;
            return(true);
        }
        done = true;
        return(false);
    }
Beispiel #4
0
    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);
    }