Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/SampSharp.OpenMp.Entities/Components/Component.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected internal virtual IEntityManager Manager
/// <summary>
/// Gets the parent entity of the entity to which this component has been attached.
/// </summary>
public EntityId Parent => Manager.GetParent(Entity);
public virtual EntityId Parent => Manager.GetParent(Entity);

/// <summary>
/// Gets the entity to which this component has been attached.
Expand All @@ -32,21 +32,21 @@ protected internal virtual IEntityManager Manager
/// <summary>
/// Gets a value indicating whether this component is alive (has not been destroyed).
/// </summary>
public bool IsComponentAlive { get; private set; } = true;
public virtual bool IsComponentAlive { get; private set; } = true;

/// <summary>
/// Gets a value indicating whether this component is being destroyed. This property is set to <see langword="true" /> when the
/// destruction of this component has been initiated.
/// </summary>
public bool IsDestroying { get; private set; }
public virtual bool IsDestroying { get; private set; }

/// <summary>
/// Gets a component of the specified type <typeparamref name="T" /> attached to the entity.
/// </summary>
/// <typeparam name="T">The type of the component to find.</typeparam>
/// <returns>The found component or <see langword="null" /> if no component of the specified type could be found.</returns>
[Pure]
public T? GetComponent<T>() where T : Component
public virtual T? GetComponent<T>() where T : Component
{
return Manager.GetComponent<T>(Entity);
}
Expand All @@ -58,7 +58,7 @@ protected internal virtual IEntityManager Manager
/// <typeparam name="T">The type of the component to add.</typeparam>
/// <param name="args">The arguments of the constructor of the component.</param>
/// <returns>The created component.</returns>
public T AddComponent<T>(params object[] args) where T : Component
public virtual T AddComponent<T>(params object[] args) where T : Component
{
return Manager.AddComponent<T>(Entity, args);
}
Expand All @@ -68,7 +68,7 @@ public T AddComponent<T>(params object[] args) where T : Component
/// </summary>
/// <typeparam name="T">The type of the component to add.</typeparam>
/// <returns>The created component.</returns>
public T AddComponent<T>() where T : Component
public virtual T AddComponent<T>() where T : Component
{
return Manager.AddComponent<T>(Entity);
}
Expand All @@ -78,7 +78,7 @@ public T AddComponent<T>() where T : Component
/// </summary>
/// <typeparam name="T">The type of the component to add.</typeparam>
/// <param name="component">The instance of component to be added.</param>
public void AddComponent<T>(T component) where T : Component
public virtual void AddComponent<T>(T component) where T : Component
{
ArgumentNullException.ThrowIfNull(component);

Expand All @@ -90,23 +90,23 @@ public void AddComponent<T>(T component) where T : Component
/// entity.
/// </summary>
/// <typeparam name="T">The type of the components to destroy.</typeparam>
public void DestroyComponents<T>() where T : Component
public virtual void DestroyComponents<T>() where T : Component
{
Manager.Destroy<T>(Entity);
}

/// <summary>
/// Destroys the entity.
/// </summary>
public void DestroyEntity()
public virtual void DestroyEntity()
{
Manager.Destroy(Entity);
}

/// <summary>
/// Destroys this component.
/// </summary>
public void Destroy()
public virtual void Destroy()
{
Manager.Destroy(this);
}
Expand All @@ -117,7 +117,7 @@ public void Destroy()
/// <typeparam name="T">The type of the components to find.</typeparam>
/// <returns>A collection of the found components.</returns>
[Pure]
public T[] GetComponents<T>() where T : Component
public virtual T[] GetComponents<T>() where T : Component
{
return Manager.GetComponents<T>(Entity);
}
Expand All @@ -129,7 +129,7 @@ public T[] GetComponents<T>() where T : Component
/// <typeparam name="T">The type of the component to find.</typeparam>
/// <returns>The found component or <see langword="null" /> if no component of the specified type could be found.</returns>
[Pure]
public T? GetComponentInChildren<T>() where T : Component
public virtual T? GetComponentInChildren<T>() where T : Component
{
return Manager.GetComponentInChildren<T>(Entity);
}
Expand All @@ -141,7 +141,7 @@ public T[] GetComponents<T>() where T : Component
/// <typeparam name="T">The type of the components to find.</typeparam>
/// <returns>A collection of the found components.</returns>
[Pure]
public T[] GetComponentsInChildren<T>() where T : Component
public virtual T[] GetComponentsInChildren<T>() where T : Component
{
return Manager.GetComponentsInChildren<T>(Entity);
}
Expand All @@ -153,7 +153,7 @@ public T[] GetComponentsInChildren<T>() where T : Component
/// <typeparam name="T">The type of the component to find.</typeparam>
/// <returns>The found component or <see langword="null" /> if no component of the specified type could be found.</returns>
[Pure]
public T? GetComponentInParent<T>() where T : Component
public virtual T? GetComponentInParent<T>() where T : Component
{
return Manager.GetComponentInParent<T>(Entity);
}
Expand All @@ -165,7 +165,7 @@ public T[] GetComponentsInChildren<T>() where T : Component
/// <typeparam name="T">The type of the components to find.</typeparam>
/// <returns>A collection of the found components.</returns>
[Pure]
public T[] GetComponentsInParent<T>() where T : Component
public virtual T[] GetComponentsInParent<T>() where T : Component
{
return Manager.GetComponentsInParent<T>(Entity);
}
Expand Down
Loading