Newer
Older
Hierarchical-Task-Network-Unity-3D / Assets / Scripts / Example / Conditions / IsPaymentAvailable.cs
using UnityEngine;

/// <summary>
/// This Condition checks if the Shop Owner is in the payment area
/// </summary>
public class IsPaymentAvailable : Condition
{
    public IsPaymentAvailable(string name) : base(name)
    {

    }
    public override bool IsConditionMet(HTNPlanner planner)
    {
        Worldstate worldstate = planner.WorldState;

        if (worldstate != null) return worldstate.Get<bool>("PaymentAvailable");

        else
        {
            Debug.LogError("The worldstate is Null!");
            return false;
        }
    }
}