#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks
{
using Opsive.GraphDesigner.Runtime.Variables;
using Opsive.Shared.Utility;
using System.Collections.Generic;
using Unity.Entities;
using static Opsive.BehaviorDesigner.Runtime.BehaviorTreeData;
///
/// Interface for action tasks.
///
[ReflectedType]
[ObjectName("Actions")]
public interface IAction { }
///
/// Interface for composite tasks.
///
[ObjectName("Composites")]
public interface IComposite { }
///
/// Interface for conditional tasks.
///
[ReflectedType(typeof(bool))]
[ObjectName("Conditionals")]
public interface IConditional { }
///
/// Interface for reference-based conditional tasks that can be reevaluated.
///
public interface IConditionalReevaluation
{
///
/// Reevaluates the task logic. Returns a TaskStatus indicating how the behavior tree flow should proceed.
///
/// The status of the task during the reevaluation phase.
public TaskStatus OnReevaluateUpdate();
}
///
/// Interface for decorator tasks.
///
[ObjectName("Decorators")]
public interface IDecorator { }
///
/// Interface which specifies the IComponentData is a task.
///
public interface ITaskComponentData
{
///
/// The type of tag that should be enabled when the task is running.
///
public ComponentType Tag { get; }
///
/// The system type that the component uses.
///
public System.Type SystemType { get; }
///
/// Adds the IBufferElementData to the entity.
///
/// The world that the entity exists.
/// The entity that the IBufferElementData should be assigned to.
public void AddBufferElement(World world, Entity entity);
///
/// Clears the IBufferElementData from the entity.
///
/// The world that the entity exists.
/// The entity that the IBufferElementData should be cleared from.
public void ClearBufferElement(World world, Entity entity);
}
///
/// Interface describing tasks that can be reevaluated.
///
public interface IReevaluateResponder
{
///
/// The type of tag that should be enabled when the task is being reevaluated.
///
public ComponentType ReevaluateTag { get; }
///
/// The system type that the reevaluation component uses.
///
public System.Type ReevaluateSystemType { get; }
}
///
/// Interface describing tasks that can respond to interruptions.
///
public interface IInterruptResponder
{
///
/// The system type that the interrupt component uses.
///
public System.Type InterruptSystemType { get; }
}
///
/// Represents a task that can be saved and restored later.
///
public interface ISavableTask
{
///
/// Specifies the type of reflection that should be used to save the task.
///
/// The index of the sub-task. This is used for the task set allowing each contained task to have their own save type.
public MemberVisibility GetSaveReflectionType(int index);
///
/// Returns the current task state.
///
/// The DOTS world.
/// The DOTS entity.
/// The current task state.
public object Save(World world, Entity entity) { return null; }
///
/// Loads the previous task state.
///
/// The previous task state.
/// The DOTS world.
/// The DOTS entity.
public void Load(object saveData, World world, Entity entity) { }
///
/// Loads the previous task state.
///
/// The previous task state.
/// The DOTS world.
/// The DOTS entity.
/// A reference to the map between the VariableAssignment and SharedVariable.
/// A reference to the list of task references that need to be resolved later.
public void Load(object saveData, World world, Entity entity, Dictionary variableByNameMap,
ref ResizableArray taskReferences) { Load(saveData, world, entity); }
}
///
/// Represents a task that can be paused and resumed later.
///
public interface IPausableTask
{
///
/// The task has been paused.
///
/// The DOTS world.
/// The DOTS entity.
public void Pause(World world, Entity entity);
///
/// The task has been resumed.
///
/// The DOTS world.
/// The DOTS entity.
public void Resume(World world, Entity entity);
}
}
#endif