Class Role
Defines the class for role-related classes.
public abstract class Role : TypeCastObject<Role>, IWrapper<PlayerRoleBase>
- Inheritance
-
Role
- Implements
-
IWrapper<PlayerRoleBase>
- Derived
- Inherited Members
- Extension Methods
Constructors
Role(PlayerRoleBase)
Initializes a new instance of the Role class.
protected Role(PlayerRoleBase baseRole)
Parameters
baseRole
PlayerRoleBasethe base PlayerRoles.PlayerRoleBase.
Properties
ActiveTime
Gets the last time the Role was active.
public TimeSpan ActiveTime { get; }
Property Value
Base
Gets the base PlayerRoles.PlayerRoleBase.
public PlayerRoleBase Base { get; }
Property Value
- PlayerRoleBase
Color
Gets the UnityEngine.Color of this Role.
public Color Color { get; }
Property Value
- Color
IsAlive
Gets a value indicating whether this role represents a living role.
public bool IsAlive { get; }
Property Value
IsDead
Gets a value indicating whether this role represents a dead role.
public bool IsDead { get; }
Property Value
IsValid
Gets a value indicating whether this role is still valid. This will only ever be false if the Role is stored and accessed at a later date.
public bool IsValid { get; }
Property Value
LifeIdentifier
Gets the life identifier for the role.
public int LifeIdentifier { get; }
Property Value
Name
Gets the Role full name.
public string Name { get; }
Property Value
Owner
Gets the Player this role is referring to.
public virtual Player Owner { get; }
Property Value
RandomSpawnLocation
Gets a random spawn position of this role.
public virtual SpawnLocation RandomSpawnLocation { get; }
Property Value
- SpawnLocation
The spawn position.
Side
public Side Side { get; }
Property Value
SpawnFlags
Gets the PlayerRoles.RoleSpawnFlags.
public RoleSpawnFlags SpawnFlags { get; }
Property Value
- RoleSpawnFlags
SpawnReason
Gets the PlayerRoles.RoleChangeReason.
public RoleChangeReason SpawnReason { get; }
Property Value
- RoleChangeReason
Team
Gets the PlayerRoles.Team of this Role.
public Team Team { get; }
Property Value
- Team
Type
Gets the PlayerRoles.RoleTypeId of this Player.
public abstract RoleTypeId Type { get; }
Property Value
- RoleTypeId
Methods
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
Set(RoleTypeId, SpawnReason)
Sets the player's PlayerRoles.RoleTypeId.
public virtual void Set(RoleTypeId newRole, SpawnReason reason = SpawnReason.ForceClass)
Parameters
newRole
RoleTypeIdThe new PlayerRoles.RoleTypeId to be set.
reason
SpawnReasonThe SpawnReason defining why the player's role was changed.
Set(RoleTypeId, SpawnReason, RoleSpawnFlags)
Sets the player's PlayerRoles.RoleTypeId.
public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags spawnFlags)
Parameters
newRole
RoleTypeIdThe new PlayerRoles.RoleTypeId to be set.
reason
SpawnReasonThe SpawnReason defining why the player's role was changed.
spawnFlags
RoleSpawnFlagsThe PlayerRoles.RoleSpawnFlags defining player spawn logic.
Set(RoleTypeId, RoleSpawnFlags)
Sets the player's PlayerRoles.RoleTypeId.
public virtual void Set(RoleTypeId newRole, RoleSpawnFlags spawnFlags)
Parameters
newRole
RoleTypeIdThe new PlayerRoles.RoleTypeId to be set.
spawnFlags
RoleSpawnFlagsThe PlayerRoles.RoleSpawnFlags defining player spawn logic.
ToString()
Returns the role in a human-readable format.
public override string ToString()
Returns
- string
A string containing role-related data.
Operators
operator ==(Role, Role)
Returns whether 2 roles are the same.
public static bool operator ==(Role left, Role right)
Parameters
Returns
operator ==(Role, RoleTypeId)
Returns whether the role has the same RoleTypeId as the given typeId
.
public static bool operator ==(Role role, RoleTypeId typeId)
Parameters
Returns
operator ==(RoleTypeId, Role)
Returns whether the role has the same RoleTypeId as the given type
.
public static bool operator ==(RoleTypeId type, Role role)
Parameters
Returns
implicit operator RoleTypeId(Role)
Converts a role to its appropriate PlayerRoles.RoleTypeId.
public static implicit operator RoleTypeId(Role role)
Parameters
role
RoleThe role.
Returns
- RoleTypeId
operator !=(Role, Role)
Returns whether the two roles are different.
public static bool operator !=(Role left, Role right)
Parameters
Returns
operator !=(Role, RoleTypeId)
Returns whether the role has a different RoleTypeId as the given typeId
.
public static bool operator !=(Role role, RoleTypeId typeId)
Parameters
Returns
operator !=(RoleTypeId, Role)
Returns whether the role has a different RoleTypeId as the given type
.
public static bool operator !=(RoleTypeId type, Role role)