public interface IModelConfig : IIconAsset
{
Sprite PreviewSprite();
Object PreviewAsset();
}
/// <summary>
/// Can be used to group skill, make skills available for specific classes etc.
/// </summary>
[EditorIcon("icon-id")]
[Serializable]
public class SkillType : IDAsset, IIconAsset
{
public Sprite Icon;
public Sprite AssetIcon => Icon;
}
public interface IActionConfig : IScriptableObject
{
IEnumerable<string> Format { get; }
IBaseAction CreateAction();
}
public interface IBaseAction { }
public interface IDefaultAction : IBaseAction
{
void Invoke();
}
public interface IUpdatingAction : IBaseAction
{
bool IsFinished { get; }
void Init();
void Update(float dt);
}
IActionConfig
implementation. (Highlighted texts, inspired by RPG Maker)
public interface ITaskConfig : IScriptableObject
{
// provides a readable highlighted text output for this config
IEnumerable<string> Format { get; }
ITask GetAction(GameObject actor);
}
public interface ITask
{
void UpdateTarget();
TaskState CanExecute();
ICommand GetCommand();
}
public enum TaskState
{
CannotExecute,
Evaluating,
ReadyToExecute
}
TaskState.Evaluating
is returned.
For execution the task itself will return a command. Commands are small executable actions like moving or interacting (picking something up).
MoveCommand
for moving a step,InteractCommand
for executing an IInteraction
.SkillItemCommand
, which is used to execute skills and using items.
/// <summary>
/// commands are small actions that can be executed by agents,
/// AI-evaluation picks best command via tasks,
/// agent only has one command at a time and picks the next command
/// once it is done
/// </summary>
public interface ICommand
{
bool Done { get; }
void Execute(float delta);
}
public interface ICommandControls : IInputActionReceiver
{
/// <summary>
/// retrieve command, take over responsibility
/// </summary>
public ICommand GetCommand();
void UpdateControl(float delta);
void Clear();
}
public interface IInteractionConfig : IScriptableObject
{
IInteraction CreateTaskTarget(IInteractiveEntity entity);
}
/// <summary>
/// Interface for specific actions on targets.
/// Used for player-interaction to check if possible or
/// for AI to also figure out the priority
/// </summary>
public interface IInteraction : IPositioned
{
IInteractiveEntity Entity { get; }
bool IsTask(IEntity actor);
int TaskPriority(IEntity actor);
bool CanInteract(IEntity actor);
}
public interface IFeatureTrait : IScriptableObject
{
public string Name { get; }
}
public interface IActivatingFeatureTrait : IFeatureTrait
{
void Activate(GameObject actor);
void Deactivate(GameObject actor);
}
public interface ITickingFeatureTrait : IFeatureTrait
{
void Tick(GameObject actor);
}
// You can also implement a feature trait as Stat-Modifier
public interface IStatModifier
{
void GetStatModifications(List<StatBuffData> stats,
List<EnergyBuffData> energies);
}
public interface IEffect : IScriptableObject
{
}
// An effect that applies to the excecution of the skill
public interface ISkillModEffect : IEffect
{
// custom data will contain excecution data for the skill
void Apply(object customData);
}
// An effect that applies to the target positions, independent of target-entities
public interface IPositionEffect : IEffect
{
void Apply(Vector3Int position, object customData);
}
// An effect that applies to entities on the target-positions
public interface ITargetEffect : IEffect
{
void Apply(IEntity actor, IEntity target, object customData);
}
public interface ISpecialAbility : IScriptableObject
{
public void Apply(IEntity actor, object customData);
}
// actors have special abilities
public interface IHaveSpecialAbilities
{
IEnumerable<SpecialAbility> SpecialAbilities { get; }
void Add(SpecialAbility ability);
void Remove(SpecialAbility ability);
bool HasAbility(SpecialAbility ability);
}
// hook-evaluations are used to test whether to trigger an ability
public interface IHookEvaluation : IScriptableObject
{
bool Activate( // the actor for which the hook is evaluated (can be actor or target in eventData or neither)
IEntity actor,
// the event that has been triggered
HookTriggered eventData,
// custom Data, that is not specific to the hook (like custom data in eventData),
// but bound to the actor and component for which the hook is evaluated
// f.e. for states it can be how many ticks the state has been active,
// for abilities the last tick it was triggered, etc.
// can be null
object customHookEvaluationData);
}
public struct HookTriggered
{
public TriggerHookID Hook;
// can be null if global hook
public IEntity Actor;
// for TargetEffects
public List<IEntity> Targets;
// custom data to evaluate hook (specific to the hook, like combat data in case of combat-hook)
public object CustomData;
}
(Hooks are also used to remove affliction-states)
public interface IQuestConfig : IScriptableObject
{
IQuestObjective CreateQuest();
}
public interface IQuestFailConfig : IScriptableObject
{
IQuestFailCondition CreateFailCondition();
}
public interface IQuestObjective
{
bool Locked { get; }
string ShortText { get; }
bool IsFinished { get; }
void Start();
void End();
}
public interface IProgressQuest : IQuestObjective
{
// QuestObjective can be used as ProgressQuest or not
// depending f.e. on amount of items to collect or creatures to kill
bool IsProgressQuest { get; }
float MissionProgress { get; }
}
public interface ITimedQuest : IProgressQuest
{
}
//...