Table of Contents

Class FarmerAI

Namespace
GrindFest
Assembly
GrindFest.dll

AI for a Farmer NPC that autonomously cycles through all four farming actions: Till → Plant → Water → Harvest → repeat.

The farmer inserts its farming loop before the wander behaviour (via BeforeWander(BehaviorTreeBuilder)), so it only wanders when there's nothing to farm.

Players can observe this NPC to learn the bot API:

// What this NPC does — you can do the same!
while (IsBotting)
{
    if (Hero.Till()  == ActionResult.Done) continue;
    if (Hero.Plant() == ActionResult.Done) continue;
    if (Hero.Water() == ActionResult.Done) continue;
    Hero.Harvest();
}
[RequireComponent(typeof(CharacterBehaviour))]
[RequireComponent(typeof(SkillUserBehaviour))]
public class FarmerAI : AIBehaviour
Inheritance
object
FarmerAI

Fields

CropType
FarmRadius

Methods

Awake()
BeforeWander(BehaviorTreeBuilder)

Inserts the full Till → Plant → Water → Harvest loop before the default Wander step.