mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-28 19:43:55 +00:00
add hud string method and code docs for modifiers
This commit is contained in:
1 parent
264defe8bf
commit
1f357b5e08
6 files changed
+129
-18
No files matched your search
@@ -1,14 +1,74 @@
|
||||
namespace MiraAPI.Modifiers;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for all modifiers.
|
||||
/// </summary>
|
||||
public abstract class BaseModifier
|
||||
{
|
||||
public abstract string ModifierName { get; }
|
||||
public virtual bool HideOnUi => false;
|
||||
public PlayerControl Player { get; internal set; }
|
||||
/// <summary>
|
||||
/// Gets the player that the modifier is attached to.
|
||||
/// </summary>
|
||||
public PlayerControl? Player { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the modifier id.
|
||||
/// </summary>
|
||||
public uint ModifierId { get; internal set; }
|
||||
public virtual void OnActivate() { }
|
||||
public virtual void OnDeactivate() { }
|
||||
public virtual void Update() { }
|
||||
public virtual void FixedUpdate() { }
|
||||
public virtual void OnDeath() { }
|
||||
public virtual bool CanVent() => Player.Data.Role.CanVent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the modifier name.
|
||||
/// </summary>
|
||||
public abstract string ModifierName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the modifier is hidden on the UI.
|
||||
/// </summary>
|
||||
public virtual bool HideOnUi => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HUD information for this modifier. Defaults to the modifier name. Does nothing if <see cref="HideOnUi"/> is true.
|
||||
/// </summary>
|
||||
/// <returns>The information string for the HUD.</returns>
|
||||
public virtual string GetHudString() => ModifierName;
|
||||
|
||||
/// <summary>
|
||||
/// Called when the modifier is activated.
|
||||
/// </summary>
|
||||
public virtual void OnActivate()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the modifier is deactivated.
|
||||
/// </summary>
|
||||
public virtual void OnDeactivate()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the modifier is updated. Attached to the ModifierComponent's Update method.
|
||||
/// </summary>
|
||||
public virtual void Update()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the modifier is updated. Attached to the ModifierComponent's FixedUpdate method.
|
||||
/// </summary>
|
||||
public virtual void FixedUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the player dies.
|
||||
/// </summary>
|
||||
public virtual void OnDeath()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the player can vent.
|
||||
/// </summary>
|
||||
/// <returns>True if the player can vent, false otherwise.</returns>
|
||||
public virtual bool CanVent() => Player?.Data.Role.CanVent == true;
|
||||
}
|
||||
Reference in new issue
Block a user