Class Player
- Namespace
- AO
- Assembly
- CoreAssembly.dll
The Player component. You may extend this class to add your own functionality to the player.
public class Player : Component
- Inheritance
-
Player
- Inherited Members
- Extension Methods
Examples
public class MyPlayer : Player
{
public override void Start() {}
public override void Update() {}
}
Fields
AbilityInstances
public List<Ability> AbilityInstances
Field Value
Agent
public Movement_Agent Agent
Field Value
BlockEmoteReasons
public List<string> BlockEmoteReasons
Field Value
CurrentTargettingAbility
public Ability CurrentTargettingAbility
Field Value
CurrentTargettingAbilityIndex
public int CurrentTargettingAbilityIndex
Field Value
CurrentTargettingCurrentlySelections
public List<Player> CurrentTargettingCurrentlySelections
Field Value
CurrentTargettingDirection
public Vector2 CurrentTargettingDirection
Field Value
CurrentTargettingMagnitude
public float CurrentTargettingMagnitude
Field Value
DefaultInventory
public Inventory DefaultInventory
Field Value
Effects
public List<AEffect> Effects
Field Value
FootstepOverride
public string[] FootstepOverride
Field Value
- string[]
MaxAbilitiesInDefaultUI
public const int MaxAbilitiesInDefaultUI = 6
Field Value
TargettingEffect
public AEffect TargettingEffect
Field Value
Properties
ActiveEffect
The current ActiveEffect on the player, if any. There may only be one active effect on a player, adding another will cancel the existing one.
public AEffect ActiveEffect { get; }
Property Value
DisableDirectionalFlipping
Override this if you would like to disable the directional flipping of the player
public virtual bool DisableDirectionalFlipping { get; }
Property Value
DoOverrideStateMachineMovingVariable
public bool DoOverrideStateMachineMovingVariable { get; set; }
Property Value
FinalNameRect
public Rect FinalNameRect { get; set; }
Property Value
FullNameplateRect
public Rect FullNameplateRect { get; set; }
Property Value
HasActiveEffect
public bool HasActiveEffect { get; }
Property Value
InputOverride
public Vector2 InputOverride { get; set; }
Property Value
InputThisFrame
public Vector2 InputThisFrame { get; set; }
Property Value
IsAdmin
Is the Player an All Out admin.
public bool IsAdmin { get; }
Property Value
IsLocal
public bool IsLocal { get; set; }
Property Value
IsVIP
public bool IsVIP { get; }
Property Value
IsValidTarget
Checks player effects for any IsValidTarget == false.
public bool IsValidTarget { get; }
Property Value
LastInputs
public Vector2 LastInputs { get; set; }
Property Value
MovementKind
The movement kind of the player. Override this to change how the player moves. Kinds: Default: WASD movement MoveToMouse: Constantly move towards the mouse
public virtual Player.PlayerMovementKind MovementKind { get; }
Property Value
Name
The name of the player
public string Name { get; }
Property Value
NameOffset
Y offset of the players name.
public float NameOffset { get; set; }
Property Value
SpineAnimator
The animator of the player. Lovingly referred to as the "Schleem"
public Spine_Animator SpineAnimator { get; }
Property Value
StateMachineMovingVariableValue
public bool StateMachineMovingVariableValue { get; set; }
Property Value
UserId
The user id of the player
public string UserId { get; }
Property Value
VolumeForLocalPlayer
public float VolumeForLocalPlayer { get; set; }
Property Value
Methods
ActivateAbility(Type, int)
public bool ActivateAbility(Type abilityType, int abilityIndex)
Parameters
Returns
ActivateAbility<T>(int)
public bool ActivateAbility<T>(int abilityIndex)
Parameters
abilityIndex
int
Returns
Type Parameters
T
AddDisableMovementInputReason(string)
Add a reason to disable movement input for the player. The players controls will be disabled if there are one or more reasons.
public void AddDisableMovementInputReason(string reason)
Parameters
reason
string
AddEffectCommon(Player, Type, float?, Action<AEffect>)
Adds an effect to the player.
public AEffect AddEffectCommon(Player caster, Type effectType, float? duration = null, Action<AEffect> preInit = null)
Parameters
caster
Player[Optional] The player who cast the effect.
effectType
TypeThe type of effect to add.
duration
float?[Optional] The duration of the effect. If null, the effect's default duration will be used, and if that is not set then the effect will be permanent.
preInit
Action<AEffect>[Optional] A callback to run before the effect is initialized.
Returns
- AEffect
The added effect.
AddEffectWithNoCeremony(Type)
public AEffect AddEffectWithNoCeremony(Type effectType)
Parameters
effectType
Type
Returns
AddEffect<T>(Player, float?, Action<T>)
Adds an effect to the player. If the effect is an active effect, it will cancel the existing active effect.
public T AddEffect<T>(Player caster = null, float? duration = null, Action<T> preInit = null) where T : AEffect
Parameters
caster
Player[Optional] The player who cast the effect.
duration
float?[Optional] The duration of the effect. If null, the effect's default duration will be used, and if that is not set then the effect will be permanent.
preInit
Action<T>[Optional] A callback to run before the effect is initialized.
Returns
- T
The added effect.
Type Parameters
T
The type of effect to add.
AddEmoteBlockReason(string)
Add a reason that disallow emoting.
public void AddEmoteBlockReason(string reason)
Parameters
reason
string
AddFreezeReason(string)
Add a reason to freeze the players movement. The player will not be able to move if there are one or move freeze reasons.
public void AddFreezeReason(string reason)
Parameters
reason
string
AddInvisibilityReason(string)
Add a reason to make the player invisible. The player will not be visible if there are one or more invisibility reasons.
public void AddInvisibilityReason(string reason)
Parameters
reason
string
AddJoystickDisableReason(string)
Hides the joystick.
public void AddJoystickDisableReason(string reason)
Parameters
reason
string
AddNameInvisibilityReason(string)
Add a reason to make the players name invisible. The players name will not be visible if there are one or more name invisibility reasons.
public void AddNameInvisibilityReason(string reason)
Parameters
reason
string
AddStat(string, long, Texture)
public void AddStat(string name, long startingValue, Texture icon)
Parameters
CalculatePlayerVelocity(Vector2, Vector2, float)
Override this to change how player velocity is calculated. This is called every frame, and how the return value differs from the current velocity is remembered and taken into account during resimulations (client-side prediction).
[Obsolete("Use Movement_Agent.CustomVelocityCallback instead.")]
public virtual Vector2 CalculatePlayerVelocity(Vector2 currentVelocity, Vector2 input, float deltaTime)
Parameters
Returns
CanUseAbility(Ability)
Returns whether a player is allowed to use an ability. Used in conjunction with Ability.CanUse().
public virtual bool CanUseAbility(Ability ability)
Parameters
ability
Ability
Returns
ClearAllEffects()
Removes all effects from the player, including the active effect.
public void ClearAllEffects()
DefaultPlayerVelocityCalculation(Vector2, Vector2, float, float)
This is the default function used to calculare player velocity. Useful to use if you want to retain default movement in some cases when overriding AO.Player.CalculatePlayerVelocity
public Vector2 DefaultPlayerVelocityCalculation(Vector2 currentVelocity, Vector2 input, float deltaTime, float accelerationMultiplier)
Parameters
Returns
DrawCircleAimingIndicator(Vector2)
public static void DrawCircleAimingIndicator(Vector2 position)
Parameters
position
Vector2
DrawDefaultAbilityUI(AbilityDrawOptions)
public Player.AbilityDrawResult DrawDefaultAbilityUI(Player.AbilityDrawOptions opt)
Parameters
Returns
DrawLineAimingIndicator(Vector2)
public void DrawLineAimingIndicator(Vector2 dir)
Parameters
dir
Vector2
DrawLineAimingIndicator(Vector2, Vector2)
public static void DrawLineAimingIndicator(Vector2 dir, Vector2 worldPosition)
Parameters
DrawMovingArrows(Rect, int, float, float)
public static void DrawMovingArrows(Rect rect, int arrowCount, float fadePercent, float fadeOutEnd)
Parameters
GetAbility(Type)
public Ability GetAbility(Type abilityType)
Parameters
abilityType
Type
Returns
GetAbility<T>()
public T GetAbility<T>() where T : Ability
Returns
- T
Type Parameters
T
GetDisableDirectionalFlipping()
Get the name of the player
public bool GetDisableDirectionalFlipping()
Returns
GetEffect(Type)
public AEffect GetEffect(Type type)
Parameters
type
Type
Returns
GetEffect<T>()
Returns the effect of the given type or null if the player does not have an effect of that type.
public T GetEffect<T>() where T : AEffect
Returns
- T
Type Parameters
T
GetFacingDirection()
Gets the direction the player is currently facing. True = Right. False = Left.
public bool GetFacingDirection()
Returns
GetFriends()
public Friend[] GetFriends()
Returns
- Friend[]
GetFriends_Internal(ulong)
public static extern Friend[] GetFriends_Internal(ulong player_entity_id)
Parameters
player_entity_id
ulong
Returns
- Friend[]
GetKeybindDown(Keybind)
public bool GetKeybindDown(Keybind id)
Parameters
id
Keybind
Returns
GetKeybindHeld(Keybind)
public bool GetKeybindHeld(Keybind id)
Parameters
id
Keybind
Returns
GetKeybindSprite(Keybind)
public Texture GetKeybindSprite(Keybind id)
Parameters
id
Keybind
Returns
GetKeybindString(Keybind)
public string GetKeybindString(Keybind id)
Parameters
id
Keybind
Returns
GetKeybindUp(Keybind)
public bool GetKeybindUp(Keybind id)
Parameters
id
Keybind
Returns
GetMousePosition()
Get the mouse position in world space. This may be called on the client and the server.
public Vector2 GetMousePosition()
Returns
GetMovementKind()
Get the movement kind of the player
public int GetMovementKind()
Returns
GetSortedTargetsForAbility(Ability)
public List<Player> GetSortedTargetsForAbility(Ability ability)
Parameters
ability
Ability
Returns
GetSpineInstanceForPlayerList()
public SpineInstance GetSpineInstanceForPlayerList()
Returns
GetStat(string)
public long GetStat(string name)
Parameters
name
string
Returns
GetWorldRect()
The world rect of the player positioned at their feet.
public Rect GetWorldRect()
Returns
GetZOffset()
public float GetZOffset()
Returns
HasDisableMovementInputReasons()
Remove a reason to disable movement input.
public bool HasDisableMovementInputReasons()
Returns
HasEffect(Type)
Returns true if the player has an active effect of the given type, or if the player has an effect of the given type.
public bool HasEffect(Type type)
Parameters
type
Type
Returns
HasEffect<T>()
Returns true if the player has an active effect of the given type, or if the player has an effect of the given type.
public bool HasEffect<T>() where T : AEffect
Returns
Type Parameters
T
HasFreezeReasons()
Remove a reason to freeze the players movement
public bool HasFreezeReasons()
Returns
HasInvisibilityReasons()
Remove a reason to make the player invisible
public bool HasInvisibilityReasons()
Returns
HasNameInvisibilityReasons()
Remove a reason to make the players name invisible
public bool HasNameInvisibilityReasons()
Returns
IsInputDown(UnifiedInput)
Check if an input is down this frame. This may be called on the client and the server.
public bool IsInputDown(Input.UnifiedInput input)
Parameters
input
Input.UnifiedInput
Returns
IsInputHeld(UnifiedInput)
Check if an input is held. This may be called on the client and the server.
public bool IsInputHeld(Input.UnifiedInput input)
Parameters
input
Input.UnifiedInput
Returns
IsInputRepeat(UnifiedInput)
Check if an input is repeating. This may be called on the client and the server.
public bool IsInputRepeat(Input.UnifiedInput input)
Parameters
input
Input.UnifiedInput
Returns
IsInputUp(UnifiedInput)
Check if an input is up this frame. This may be called on the client and the server.
public bool IsInputUp(Input.UnifiedInput input)
Parameters
input
Input.UnifiedInput
Returns
OnActivatedAbility(Ability)
public virtual void OnActivatedAbility(Ability ability)
Parameters
ability
Ability
PlayRandomFootstep()
public void PlayRandomFootstep()
ReadFrameData(StreamReader)
public virtual void ReadFrameData(StreamReader reader)
Parameters
reader
StreamReader
RemoveDisableMovementInputReason(string)
Remove a reason to disable movement input.
public bool RemoveDisableMovementInputReason(string reason)
Parameters
reason
string
Returns
RemoveEffect(AEffect, bool)
Removes an effect from the player. This will remove the active effect if it matches the given effect.
public bool RemoveEffect(AEffect effect, bool interrupt)
Parameters
Returns
RemoveEffect(Type, bool)
Removes an effect from the player. This will remove the active effect if it matches the given type.
public bool RemoveEffect(Type effectType, bool interrupt)
Parameters
effectType
TypeThe type of effect to remove.
interrupt
boolIf true, the effect will be interrupted and its OnEffectEnd method will be called with interrupt=true.
Returns
- bool
True if the effect was removed, false if it was not found.
RemoveEffect<T>(bool)
Removes an effect from the player. This will remove the active effect if it matches the given type.
public bool RemoveEffect<T>(bool interrupt) where T : AEffect
Parameters
interrupt
bool
Returns
Type Parameters
T
RemoveEmoteBlockReason(string)
Remove a reason that disallow emoting.
public void RemoveEmoteBlockReason(string reason)
Parameters
reason
string
RemoveFreezeReason(string)
Remove a reason to freeze the players movement
public bool RemoveFreezeReason(string reason)
Parameters
reason
string
Returns
RemoveInvisibilityReason(string)
Remove a reason to make the player invisible
public bool RemoveInvisibilityReason(string reason)
Parameters
reason
string
Returns
RemoveJoystickDisableReason(string)
Un-hides the joystick.
public bool RemoveJoystickDisableReason(string reason)
Parameters
reason
string
Returns
RemoveNameInvisibilityReason(string)
Remove a reason to make the players name invisible
public bool RemoveNameInvisibilityReason(string reason)
Parameters
reason
string
Returns
RemoveStat(string)
public void RemoveStat(string name)
Parameters
name
string
SetAimTarget(Vector2)
public void SetAimTarget(Vector2 target)
Parameters
target
Vector2
SetChatChannel(int)
public void SetChatChannel(int channel)
Parameters
channel
int
SetFacingDirection(bool)
Sets the direction you want the player to face. Should be paired with DisableDirectionalFlipping
public void SetFacingDirection(bool faceRight)
Parameters
faceRight
bool
SetMouseIKEnabled(bool)
Set the mouse IK enabled.
public void SetMouseIKEnabled(bool enabled)
Parameters
enabled
bool
StopActiveEffect(bool)
Stops the active effect on the player, if any.
public void StopActiveEffect(bool interrupt)
Parameters
interrupt
boolIf true, the effect will be interrupted and its OnEffectEnd method will be called with interrupt=true.
StopEffect(AEffect, int, bool)
public void StopEffect(AEffect effect, int index, bool interrupt)
Parameters
Teleport(Vector2)
Teleport the player to a position
public void Teleport(Vector2 position)
Parameters
position
Vector2
TryGetEffect<T>(out T)
Returns the effect of the given type or null if the player does not have an effect of that type.
public bool TryGetEffect<T>(out T effect) where T : AEffect
Parameters
effect
T
Returns
Type Parameters
T
TryLocalSetCurrentTargettingAbility(Ability, int)
public bool TryLocalSetCurrentTargettingAbility(Ability ability, int index)
Parameters
Returns
UpdateStat(string, long)
public void UpdateStat(string name, long val)
Parameters
WriteFrameData(StreamWriter)
public virtual void WriteFrameData(StreamWriter writer)
Parameters
writer
StreamWriter