Class Role
Defines the class for role-related classes.
Inheritance
Implements
Inherited Members
Namespace: Exiled.API.Features.Roles
Assembly: Exiled.API.dll
Syntax
public abstract class Role : TypeCastObject<Role>, IWrapper<PlayerRoleBase>
Constructors
| Improve this Doc View SourceRole(PlayerRoleBase)
Initializes a new instance of the Role class.
Declaration
protected Role(PlayerRoleBase baseRole)
Parameters
Type | Name | Description |
---|---|---|
PlayerRoles.PlayerRoleBase | baseRole | the base PlayerRoles.PlayerRoleBase. |
Properties
| Improve this Doc View SourceActiveTime
Gets the last time the Role was active.
Declaration
public TimeSpan ActiveTime { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
Base
Gets the base PlayerRoles.PlayerRoleBase.
Declaration
public PlayerRoleBase Base { get; }
Property Value
Type | Description |
---|---|
PlayerRoles.PlayerRoleBase |
Color
Gets the UnityEngine.Color of this Role.
Declaration
public Color Color { get; }
Property Value
Type | Description |
---|---|
UnityEngine.Color |
IsAlive
Gets a value indicating whether or not this role represents a living role.
Declaration
public bool IsAlive { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsDead
Gets a value indicating whether or not this role represents a dead role.
Declaration
public bool IsDead { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsValid
Gets a value indicating whether or not this role is still valid. This will only ever be false if the Role is stored and accessed at a later date.
Declaration
public bool IsValid { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Name
Gets the Role full name.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Owner
Gets the Player this role is referring to.
Declaration
public virtual Player Owner { get; }
Property Value
Type | Description |
---|---|
Player |
RandomSpawnLocation
Gets a random spawn position of this role.
Declaration
public virtual SpawnLocation RandomSpawnLocation { get; }
Property Value
Type | Description |
---|---|
SpawnLocation | The spawn position. |
Side
Declaration
public Side Side { get; }
Property Value
Type | Description |
---|---|
Side |
SpawnFlags
Gets the PlayerRoles.RoleSpawnFlags.
Declaration
public RoleSpawnFlags SpawnFlags { get; }
Property Value
Type | Description |
---|---|
PlayerRoles.RoleSpawnFlags |
SpawnReason
Gets the PlayerRoles.RoleChangeReason.
Declaration
public RoleChangeReason SpawnReason { get; }
Property Value
Type | Description |
---|---|
PlayerRoles.RoleChangeReason |
Team
Gets the PlayerRoles.Team of this Role.
Declaration
public Team Team { get; }
Property Value
Type | Description |
---|---|
PlayerRoles.Team |
Type
Gets the PlayerRoles.RoleTypeId of this Player.
Declaration
public abstract RoleTypeId Type { get; }
Property Value
Type | Description |
---|---|
PlayerRoles.RoleTypeId |
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
Set(RoleTypeId, SpawnReason)
Sets the player's PlayerRoles.RoleTypeId.
Declaration
public virtual void Set(RoleTypeId newRole, SpawnReason reason = SpawnReason.ForceClass)
Parameters
Type | Name | Description |
---|---|---|
PlayerRoles.RoleTypeId | newRole | The new PlayerRoles.RoleTypeId to be set. |
SpawnReason | reason | The SpawnReason defining why the player's role was changed. |
Set(RoleTypeId, SpawnReason, RoleSpawnFlags)
Sets the player's PlayerRoles.RoleTypeId.
Declaration
public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags spawnFlags)
Parameters
Type | Name | Description |
---|---|---|
PlayerRoles.RoleTypeId | newRole | The new PlayerRoles.RoleTypeId to be set. |
SpawnReason | reason | The SpawnReason defining why the player's role was changed. |
PlayerRoles.RoleSpawnFlags | spawnFlags | The PlayerRoles.RoleSpawnFlags defining player spawn logic. |
Set(RoleTypeId, RoleSpawnFlags)
Sets the player's PlayerRoles.RoleTypeId.
Declaration
public virtual void Set(RoleTypeId newRole, RoleSpawnFlags spawnFlags)
Parameters
Type | Name | Description |
---|---|---|
PlayerRoles.RoleTypeId | newRole | The new PlayerRoles.RoleTypeId to be set. |
PlayerRoles.RoleSpawnFlags | spawnFlags | The PlayerRoles.RoleSpawnFlags defining player spawn logic. |
ToString()
Returns the role in a human-readable format.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string containing role-related data. |
Overrides
Operators
| Improve this Doc View SourceEquality(Role, Role)
Returns whether or not 2 roles are the same.
Declaration
public static bool operator ==(Role left, Role right)
Parameters
Type | Name | Description |
---|---|---|
Role | left | The role. |
Role | right | The other role. |
Returns
Type | Description |
---|---|
System.Boolean | true if the values are equal. |
Equality(Role, RoleTypeId)
Returns whether or not the role has the same RoleTypeId as the given typeId
.
Declaration
public static bool operator ==(Role role, RoleTypeId typeId)
Parameters
Type | Name | Description |
---|---|---|
Role | role | The Role. |
PlayerRoles.RoleTypeId | typeId | The PlayerRoles.RoleTypeId. |
Returns
Type | Description |
---|---|
System.Boolean | true if the values are equal. |
Equality(RoleTypeId, Role)
Returns whether or not the role has the same RoleTypeId as the given type
.
Declaration
public static bool operator ==(RoleTypeId type, Role role)
Parameters
Type | Name | Description |
---|---|---|
PlayerRoles.RoleTypeId | type | The PlayerRoles.RoleTypeId. |
Role | role | The Role. |
Returns
Type | Description |
---|---|
System.Boolean | true if the values are equal. |
Implicit(Role to RoleTypeId)
Converts a role to its appropriate PlayerRoles.RoleTypeId.
Declaration
public static implicit operator RoleTypeId(Role role)
Parameters
Type | Name | Description |
---|---|---|
Role | role | The role. |
Returns
Type | Description |
---|---|
PlayerRoles.RoleTypeId |
Inequality(Role, Role)
Returns whether or not the two roles are different.
Declaration
public static bool operator !=(Role left, Role right)
Parameters
Type | Name | Description |
---|---|---|
Role | left | The role. |
Role | right | The other role. |
Returns
Type | Description |
---|---|
System.Boolean | true if the values are not equal. |
Inequality(Role, RoleTypeId)
Returns whether or not the role has a different RoleTypeId as the given typeId
.
Declaration
public static bool operator !=(Role role, RoleTypeId typeId)
Parameters
Type | Name | Description |
---|---|---|
Role | role | The Role. |
PlayerRoles.RoleTypeId | typeId | The PlayerRoles.RoleTypeId. |
Returns
Type | Description |
---|---|
System.Boolean | true if the values are not equal. |
Inequality(RoleTypeId, Role)
Returns whether or not the role has a different RoleTypeId as the given type
.
Declaration
public static bool operator !=(RoleTypeId type, Role role)
Parameters
Type | Name | Description |
---|---|---|
PlayerRoles.RoleTypeId | type | The PlayerRoles.RoleTypeId. |
Role | role | The Role. |
Returns
Type | Description |
---|---|
System.Boolean | true if the values are not equal. |