docs(core): Abstract
This commit is contained in:
parent
4ce9c8e0d9
commit
2f4137dae2
|
@ -3,22 +3,22 @@ using System;
|
||||||
namespace Syntriax.Engine.Core.Abstract;
|
namespace Syntriax.Engine.Core.Abstract;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responsible for every behaviour an object in the game might have, controlled by <see cref="IBehaviourController"/>.
|
/// Represents a behaviour that any object in the game might use to interact with itself or other objects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBehaviour : IEntity, IAssignableBehaviourController, IAssignableStateEnable, IInitialize
|
public interface IBehaviour : IEntity, IAssignableBehaviourController, IAssignableStateEnable, IInitialize
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback triggered when the <see cref="Priority"/> has changed.
|
/// Event triggered when the priority of the <see cref="IBehaviour"/> changes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Action<IBehaviour>? OnPriorityChanged { get; set; }
|
Action<IBehaviour>? OnPriorityChanged { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call priority of the <see cref="IBehaviour"/>.
|
/// The priority of the <see cref="IBehaviour"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int Priority { get; set; }
|
int Priority { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If the <see cref="IBehaviour"/> is active.
|
/// The value indicating whether the <see cref="IBehaviour"/> is active.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsActive { get; }
|
bool IsActive { get; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,102 +5,101 @@ using System.Diagnostics.CodeAnalysis;
|
||||||
namespace Syntriax.Engine.Core.Abstract;
|
namespace Syntriax.Engine.Core.Abstract;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responsible for controlling <see cref="IBehaviour"/>s and notify them accordingly about the engine's updates. Connected to an <see cref="IGameObject"/>.
|
/// Represents a controller for managing <see cref="IBehaviour"/>s and notify them accordingly about the engine's updates. Connected to an <see cref="IGameObject"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBehaviourController : IAssignableGameObject, IEnumerable<IBehaviour>
|
public interface IBehaviourController : IAssignableGameObject, IEnumerable<IBehaviour>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback triggered when the <see cref="Update()"/> is called but right before the <see cref="OnUpdate"/> action is triggered.
|
/// Event triggered before the update of <see cref="IBehaviour"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Action<IBehaviourController>? OnPreUpdate { get; set; }
|
Action<IBehaviourController>? OnPreUpdate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback triggered when the <see cref="Update()"/> is called.
|
/// Event triggered during the update of <see cref="IBehaviour"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Action<IBehaviourController>? OnUpdate { get; set; }
|
Action<IBehaviourController>? OnUpdate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback triggered when the <see cref="OnPreDraw()"/> is called.
|
/// Event triggered before the drawing phase.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Action<IBehaviourController>? OnPreDraw { get; set; }
|
Action<IBehaviourController>? OnPreDraw { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback triggered when the <see cref="IBehaviourController"/> has been registered a new <see cref="IBehaviour"/>.
|
/// Event triggered when a <see cref="IBehaviour"/> is added to the <see cref="IBehaviourController"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Action<IBehaviourController, IBehaviour>? OnBehaviourAdded { get; set; }
|
Action<IBehaviourController, IBehaviour>? OnBehaviourAdded { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback triggered when the <see cref="IBehaviourController"/> has been removed an existing <see cref="IBehaviour"/>.
|
/// Event triggered when a <see cref="IBehaviour"/> is removed from the <see cref="IBehaviourController"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Action<IBehaviourController, IBehaviour>? OnBehaviourRemoved { get; set; }
|
Action<IBehaviourController, IBehaviour>? OnBehaviourRemoved { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers the provided <see cref="IBehaviour"/> to be controlled by the <see cref="IBehaviourController"/>.
|
/// Adds a <see cref="IBehaviour"/> to the <see cref="IBehaviourController"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="behaviour">Uninitialized <see cref="IBehaviour"/> to be registered.</param>
|
/// <typeparam name="T">The type of <see cref="IBehaviour"/> to add.</typeparam>
|
||||||
/// <typeparam name="T">An implemented class of <see cref="IBehaviour"/></typeparam>
|
/// <param name="behaviour">The <see cref="IBehaviour"/> to add.</param>
|
||||||
/// <returns>The provided <see cref="IBehaviour"/> class after initialization.</returns>
|
/// <returns>The added <see cref="IBehaviour"/>.</returns>
|
||||||
T AddBehaviour<T>(T behaviour) where T : class, IBehaviour;
|
T AddBehaviour<T>(T behaviour) where T : class, IBehaviour;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Instantiates the provided <see cref="IBehaviour"/> type and registers it to the <see cref="IBehaviourController"/>.
|
/// Adds a <see cref="IBehaviour"/> of the specified type to the <see cref="IBehaviourController"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args">Constructor parameters for the given <see cref="IBehaviour"/> class.</param>
|
/// <typeparam name="T">The type of <see cref="IBehaviour"/> to add.</typeparam>
|
||||||
/// <typeparam name="T">An implemented class of <see cref="IBehaviour"/></typeparam>
|
/// <param name="args">Construction parameters for the <see cref="IBehaviour"/>.</param>
|
||||||
/// <returns>The instantiated <see cref="IBehaviour"/> class after initialization.</returns>
|
/// <returns>The added <see cref="IBehaviour"/>.</returns>
|
||||||
T AddBehaviour<T>(params object?[]? args) where T : class, IBehaviour;
|
T AddBehaviour<T>(params object?[]? args) where T : class, IBehaviour;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up and returns the <see cref="IBehaviour"/> that is controlled by the <see cref="IBehaviourController"/>.
|
/// Gets a <see cref="IBehaviour"/> of the specified type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">An implemented class or <see cref="interface"/></typeparam>
|
/// <typeparam name="T">The type of <see cref="IBehaviour"/> to get.</typeparam>
|
||||||
/// <returns>
|
/// <returns>The <see cref="IBehaviour"/> of the specified type if found; otherwise, <see cref="null"/>.</returns>
|
||||||
/// <see cref="T"/>, if the type of <see cref="IBehaviour"/> is present in the <see cref="IBehaviourController"/>, <see cref="null"/> if not.
|
|
||||||
/// </returns>
|
|
||||||
T? GetBehaviour<T>();
|
T? GetBehaviour<T>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up and tries to get the <see cref="IBehaviour"/> that is controlled by the <see cref="IBehaviourController"/>.
|
/// Tries to get a <see cref="IBehaviour"/> of the specified type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="behaviour">If return value is <see cref="true"/> outputs the class found in the <see cref="IBehaviourController"/>. If the return value is falls, this parameter is <see cref="null"/></param>
|
/// <typeparam name="T">The type of <see cref="IBehaviour"/> to get.</typeparam>
|
||||||
/// <typeparam name="T">An implemented class or <see cref="interface"/></typeparam>
|
/// <param name="behaviour">When this method returns, contains the <see cref="IBehaviour"/> of the specified type, if found; otherwise, see.</param>
|
||||||
/// <returns>
|
/// <returns><see cref="true"/> if a <see cref="IBehaviour"/> of the specified type was found; otherwise, <see cref="false"/>.</returns>
|
||||||
/// <see cref="true"/>, if the type of <see cref="IBehaviour"/> is present in the <see cref="IBehaviourController"/>, <see cref="false"/> if not.
|
|
||||||
/// </returns>
|
|
||||||
bool TryGetBehaviour<T>([NotNullWhen(returnValue: true)] out T? behaviour);
|
bool TryGetBehaviour<T>([NotNullWhen(returnValue: true)] out T? behaviour);
|
||||||
|
|
||||||
/// <typeparam name="T">An implemented class or <see cref="interface"/>.</typeparam>
|
/// <summary>
|
||||||
/// <returns>Returns a list of all the matching <see cref="IBehaviour"/>s found in the <see cref="IBehaviourController"/>.</returns>
|
/// Gets all <see cref="IBehaviour"/>s of the specified type.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type of <see cref="IBehaviour"/>s to get.</typeparam>
|
||||||
|
/// <returns>A list of <see cref="IBehaviour"/>s of the specified type.</returns>
|
||||||
IList<T> GetBehaviours<T>();
|
IList<T> GetBehaviours<T>();
|
||||||
|
|
||||||
/// <typeparam name="T">An implemented class or <see cref="interface"/>.</typeparam>
|
/// <summary>
|
||||||
/// <returns>Fills the provided list parameter all the matching <see cref="IBehaviour"/>s found in the <see cref="IBehaviourController"/>.</returns>
|
/// Gets all <see cref="IBehaviour"/>s of the specified type and stores them in the provided list.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type of <see cref="IBehaviour"/>s to get.</typeparam>
|
||||||
|
/// <param name="behaviours">The list to store the <see cref="IBehaviour"/>s.</param>
|
||||||
void GetBehaviours<T>(List<T> behaviours);
|
void GetBehaviours<T>(List<T> behaviours);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the <see cref="IBehaviour"/> found in the <see cref="IBehaviourController"/>.
|
/// Removes <see cref="IBehaviour"/>s of the specified type from the <see cref="IBehaviourController"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="removeAll">If all of the instances of the given Type is to be removed or not.</param>
|
/// <typeparam name="T">The type of <see cref="IBehaviour"/>s to remove.</typeparam>
|
||||||
/// <typeparam name="T">An implemented class or <see cref="interface"/> of <see cref="IBehaviour"/></typeparam>
|
/// <param name="removeAll">A flag indicating whether to remove all <see cref="IBehaviour"/>s of the specified type.</param>
|
||||||
void RemoveBehaviour<T>(bool removeAll = false) where T : class, IBehaviour;
|
void RemoveBehaviour<T>(bool removeAll = false) where T : class, IBehaviour;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the <see cref="IBehaviour"/> found in the <see cref="IBehaviourController"/>.
|
/// Removes the specified <see cref="IBehaviour"/> from the <see cref="IBehaviourController"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="removeAll">If all of the instances of the given Type is to be removed or not.</param>
|
/// <typeparam name="T">The type of <see cref="IBehaviour"/> to remove.</typeparam>
|
||||||
/// <typeparam name="T">An implemented class or <see cref="interface"/> of <see cref="IBehaviour"/></typeparam>
|
/// <param name="behaviour">The <see cref="IBehaviour"/> to remove.</param>
|
||||||
void RemoveBehaviour<T>(T behaviour) where T : class, IBehaviour;
|
void RemoveBehaviour<T>(T behaviour) where T : class, IBehaviour;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// To be called in every frame of the engine. Responsible for notifying <see cref="IBehaviour"/>'s under the <see cref="IBehaviourController"/>'s control that a new frame is happening.
|
/// Updates all <see cref="IBehaviour"/>s in the <see cref="IBehaviourController"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name=""><see cref=""/> information from the game.</param>
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// To be called before every draw call from the engine. Responsible for notifying <see cref="IBehaviour"/>'s under the <see cref="IBehaviourController"/>'s control that the engine is about to start drawing into the screen.
|
/// Performs pre-draw operations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name=""><see cref=""/> information from the game.</param>
|
|
||||||
void UpdatePreDraw();
|
void UpdatePreDraw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,26 @@
|
||||||
namespace Syntriax.Engine.Core.Abstract;
|
namespace Syntriax.Engine.Core.Abstract;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a 2D camera in the engine.
|
||||||
|
/// </summary>
|
||||||
public interface ICamera2D : IBehaviour, IAssignableTransform
|
public interface ICamera2D : IBehaviour, IAssignableTransform
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The zoom level of the camera.
|
||||||
|
/// </summary>
|
||||||
float Zoom { get; set; }
|
float Zoom { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts a position from screen coordinates to world coordinates.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="screenPosition">The position in screen coordinates.</param>
|
||||||
|
/// <returns>The position in world coordinates.</returns>
|
||||||
Vector2D ScreenToWorldPosition(Vector2D screenPosition);
|
Vector2D ScreenToWorldPosition(Vector2D screenPosition);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts a position from world coordinates to screen coordinates.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="worldPosition">The position in world coordinates.</param>
|
||||||
|
/// <returns>The position in screen coordinates.</returns>
|
||||||
Vector2D WorldToScreenPosition(Vector2D worldPosition);
|
Vector2D WorldToScreenPosition(Vector2D worldPosition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
namespace Syntriax.Engine.Core.Abstract;
|
namespace Syntriax.Engine.Core.Abstract;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a basic entity in the engine.
|
||||||
|
/// </summary>
|
||||||
public interface IEntity : IInitialize, IAssignableStateEnable
|
public interface IEntity : IInitialize, IAssignableStateEnable
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,19 +3,55 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Syntriax.Engine.Core.Abstract;
|
namespace Syntriax.Engine.Core.Abstract;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a game world responsible for managing <see cref="IGameObject"/>s.
|
||||||
|
/// </summary>
|
||||||
public interface IGameManager : IEntity, IEnumerable<IGameObject>
|
public interface IGameManager : IEntity, IEnumerable<IGameObject>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Event triggered when a <see cref="IGameObject"/> is registered to the <see cref="IGameManager"/>.
|
||||||
|
/// </summary>
|
||||||
Action<IGameManager, IGameObject>? OnGameObjectRegistered { get; set; }
|
Action<IGameManager, IGameObject>? OnGameObjectRegistered { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event triggered when a <see cref="IGameObject"/> is unregistered from the <see cref="IGameManager"/>.
|
||||||
|
/// </summary>
|
||||||
Action<IGameManager, IGameObject>? OnGameObjectUnRegistered { get; set; }
|
Action<IGameManager, IGameObject>? OnGameObjectUnRegistered { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a read-only list of <see cref="IGameObject"/>s managed by the <see cref="IGameManager"/>.
|
||||||
|
/// </summary>
|
||||||
IReadOnlyList<IGameObject> GameObjects { get; }
|
IReadOnlyList<IGameObject> GameObjects { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers a <see cref="IGameObject"/> to the <see cref="IGameManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameObject">The <see cref="IGameObject"/> to register.</param>
|
||||||
void RegisterGameObject(IGameObject gameObject);
|
void RegisterGameObject(IGameObject gameObject);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Instantiates a <see cref="IGameObject"/> of type T with the given arguments and registers it to the <see cref="IGameManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type of <see cref="IGameObject"/> to instantiate.</typeparam>
|
||||||
|
/// <param name="args">Constructor parameters for the given type of <see cref="IGameObject"/>.</param>
|
||||||
|
/// <returns>The instantiated <see cref="IGameObject"/>.</returns>
|
||||||
T InstantiateGameObject<T>(params object?[]? args) where T : class, IGameObject;
|
T InstantiateGameObject<T>(params object?[]? args) where T : class, IGameObject;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a <see cref="IGameObject"/> from the <see cref="IGameManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameObject">The <see cref="IGameObject"/> to remove.</param>
|
||||||
|
/// <returns>The removed <see cref="IGameObject"/>.</returns>
|
||||||
IGameObject RemoveGameObject(IGameObject gameObject);
|
IGameObject RemoveGameObject(IGameObject gameObject);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the <see cref="IGameManager"/> with the given engine time data.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="time">The engine time.</param>
|
||||||
void Update(EngineTime time);
|
void Update(EngineTime time);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Performs operations that should be done before the draw calls.
|
||||||
|
/// </summary>
|
||||||
void PreDraw();
|
void PreDraw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,18 @@ using System;
|
||||||
|
|
||||||
namespace Syntriax.Engine.Core.Abstract;
|
namespace Syntriax.Engine.Core.Abstract;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a game object with various properties and functionalities.
|
||||||
|
/// </summary>
|
||||||
public interface IGameObject : IEntity, IAssignableGameManager, IAssignableTransform, IAssignableBehaviourController, INameable, IInitialize
|
public interface IGameObject : IEntity, IAssignableGameManager, IAssignableTransform, IAssignableBehaviourController, INameable, IInitialize
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Event triggered when the <see cref="Update"/> method is called.
|
||||||
|
/// </summary>
|
||||||
Action<IGameObject>? OnUpdated { get; set; }
|
Action<IGameObject>? OnUpdated { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the game object.
|
||||||
|
/// </summary>
|
||||||
void Update();
|
void Update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,35 @@ using System;
|
||||||
|
|
||||||
namespace Syntriax.Engine.Core.Abstract;
|
namespace Syntriax.Engine.Core.Abstract;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an entity that can be initialized and finalized. This information is useful for objects we know that are not in use and can be either recycled or dropped for garbage collection.
|
||||||
|
/// </summary>
|
||||||
public interface IInitialize
|
public interface IInitialize
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Event triggered when the <see cref="Initialize"/> method is called successfully.
|
||||||
|
/// </summary>
|
||||||
Action<IInitialize>? OnInitialized { get; set; }
|
Action<IInitialize>? OnInitialized { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event triggered when the <see cref="Finalize"/> method is called successfully.
|
||||||
|
/// </summary>
|
||||||
Action<IInitialize>? OnFinalized { get; set; }
|
Action<IInitialize>? OnFinalized { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The value indicating whether the entity has been initialized.
|
||||||
|
/// </summary>
|
||||||
bool Initialized { get; }
|
bool Initialized { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the entity.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><see cref="true"/> if initialization is successful, otherwise <see cref="false"/>.</returns>
|
||||||
bool Initialize();
|
bool Initialize();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finalizes the entity so it can either be recycled or garbage collected.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><see cref="true"/> if finalization is successful, otherwise <see cref="false"/>.</returns>
|
||||||
bool Finalize();
|
bool Finalize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,18 @@ using System;
|
||||||
|
|
||||||
namespace Syntriax.Engine.Core.Abstract;
|
namespace Syntriax.Engine.Core.Abstract;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an entity with a name.
|
||||||
|
/// </summary>
|
||||||
public interface INameable
|
public interface INameable
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Event triggered when the name of the entity changes.
|
||||||
|
/// </summary>
|
||||||
Action<IEntity>? OnNameChanged { get; set; }
|
Action<IEntity>? OnNameChanged { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the entity.
|
||||||
|
/// </summary>
|
||||||
string Name { get; set; }
|
string Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,18 @@ using System;
|
||||||
|
|
||||||
namespace Syntriax.Engine.Core.Abstract;
|
namespace Syntriax.Engine.Core.Abstract;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an entity with an enable state that can be toggled.
|
||||||
|
/// </summary>
|
||||||
public interface IStateEnable : IAssignableEntity
|
public interface IStateEnable : IAssignableEntity
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Event triggered when the <see cref="Enabled"/> state of the <see cref="IStateEnable"/> changes.
|
||||||
|
/// </summary>
|
||||||
Action<IStateEnable>? OnEnabledChanged { get; set; }
|
Action<IStateEnable>? OnEnabledChanged { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The value indicating whether the <see cref="IStateEnable"/> is enabled.
|
||||||
|
/// </summary>
|
||||||
bool Enabled { get; set; }
|
bool Enabled { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,38 @@ using System;
|
||||||
|
|
||||||
namespace Syntriax.Engine.Core.Abstract;
|
namespace Syntriax.Engine.Core.Abstract;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the transformation properties of an object such as position, scale, and rotation.
|
||||||
|
/// </summary>
|
||||||
public interface ITransform
|
public interface ITransform
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Event triggered when the <see cref="Position"/> of the <see cref="ITransform"/> changes.
|
||||||
|
/// </summary>
|
||||||
Action<ITransform>? OnPositionChanged { get; set; }
|
Action<ITransform>? OnPositionChanged { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event triggered when the <see cref="Scale"/> of the <see cref="ITransform"/> changes.
|
||||||
|
/// </summary>
|
||||||
Action<ITransform>? OnScaleChanged { get; set; }
|
Action<ITransform>? OnScaleChanged { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event triggered when the <see cref="Rotation"/> of the <see cref="ITransform"/> changes.
|
||||||
|
/// </summary>
|
||||||
Action<ITransform>? OnRotationChanged { get; set; }
|
Action<ITransform>? OnRotationChanged { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The position of the <see cref="ITransform"/> in 2D space.
|
||||||
|
/// </summary>
|
||||||
Vector2D Position { get; set; }
|
Vector2D Position { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The scale of the <see cref="ITransform"/>.
|
||||||
|
/// </summary>
|
||||||
Vector2D Scale { get; set; }
|
Vector2D Scale { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The rotation of the <see cref="ITransform"/> in degrees.
|
||||||
|
/// </summary>
|
||||||
float Rotation { get; set; }
|
float Rotation { get; set; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue