Newer
Older
Hierarchical-Task-Network-Unity-3D / Assets / Scripts / Example / CompoundTask / Owner / RefillSection.cs
using UnityEngine;

/// <summary>
/// Refills a section that is empty or nearly empty
/// </summary>
public class RefillSection : CompoundTask
{
    // ================== CONSTRUCTOR ==================
    /// <summary>
    /// Task Constructor
    /// </summary>
    /// <param name="planner">The planner object to related to the condition</param>
    /// <param name="sectionName">The section name that needs to be refilled</param>
    public RefillSection(HTNPlanner planner, string sectionName)
    {
        //Cast
        ShopOwner owner = planner.Agent as ShopOwner;

        //If the cast fails
        if (owner == null)
        {
            Debug.LogError("Cast Failed!");
            return;
        }

        //
        Method method = new Method("Is a Shelf Empty and the Owner is not busy");

            //.AddPrecondition(new IsSectionEmpty($"Is Section Empty: {sectionName}", sectionName))
    }
}