Exemple #1
0
 public static GrazingSheepState GetInstance()
 {
     if (instance == null)
     {
         instance = new GrazingSheepState();
     }
     return(instance);
 }
Exemple #2
0
    public override void FixedUpdate(Sheep owner)
    {
        base.FixedUpdate(owner);

        MovingEntity entity = owner.GetSteering.GetNearestEntity();

        if (entity == null)
        {
            owner.GetFSM.ChangeState(WanderingSheepState.GetInstance());
            return;
        }

        float dist = Vector3.Distance(owner.transform.position, entity.transform.position);

        if (dist < 1)
        {
            owner.GetFSM.ChangeState(GrazingSheepState.GetInstance());
        }
    }