Class: AbilityTrigger
- Namespace:
Global - Assembly:
Dew.Core.dll - Inheritance / Derived: DewNetworkBehaviour → Actor → AttackTrigger → SkillTrigger
[LogicUpdatePriority(-300)]
public class AbilityTrigger : Actor, ILogicUpdate, ICleanup, ICustomDestroyRoutineFields
| Name | Declaration | Description |
|---|---|---|
ClientEvent_OnOwnerChanged | public SafeAction<Entity, Entity> ClientEvent_OnOwnerChanged | |
ClientTriggerEvent_OnCooldownReduced | public SafeAction<int, float> ClientTriggerEvent_OnCooldownReduced | configIndex, reductionAmount. Note the amount is non-discarded variant. e.g. Applying 100 seconds cooldown reduction to a 3 seconds skill will still report 100 seconds reduction. |
ClientTriggerEvent_OnCooldownReducedByRatio | public SafeAction<int, float> ClientTriggerEvent_OnCooldownReducedByRatio | |
ClientTriggerEvent_OnCurrentConfigCharged | public SafeAction ClientTriggerEvent_OnCurrentConfigCharged | |
ClientTriggerEvent_OnCurrentConfigCooldownReduced | public SafeAction ClientTriggerEvent_OnCurrentConfigCooldownReduced | |
configs | `[ListDrawerSettings(Expanded = true)] | |
| public TriggerConfig[] configs` | ||
currentCharges | `[SaveVar(SaveVarFlags.ApplyAfterFrameDelay)] | |
| [NonSerialized] | ||
| public int[] currentCharges` | ||
currentMinimumDelays | `[SaveVar(SaveVarFlags.ApplyAfterFrameDelay)] | |
| [NonSerialized] | ||
| public float[] currentMinimumDelays` | ||
currentUnscaledCooldownTimes | `[SaveVar(SaveVarFlags.ApplyAfterFrameDelay)] | |
| [NonSerialized] | ||
| public float[] currentUnscaledCooldownTimes` | ||
takenCooldownReductionByRatioProcessor | public DataProcessorGroup<CooldownReductionByRatioSettings, Actor, AbilityTrigger> takenCooldownReductionByRatioProcessor | |
takenCooldownReductionProcessor | public DataProcessorGroup<CooldownReductionSettings, Actor, AbilityTrigger> takenCooldownReductionProcessor | |
TriggerEvent_OnCastComplete | public Action<EventInfoCast> TriggerEvent_OnCastComplete | |
TriggerEvent_OnCastCompleteBeforePrepare | public Action<EventInfoCast> TriggerEvent_OnCastCompleteBeforePrepare | |
TriggerEvent_OnCastStart | public Action<EventInfoCast> TriggerEvent_OnCastStart |
Properties
| Name | Declaration | Description |
|---|---|---|
abilityIndex | public int abilityIndex { get; } | Ability index of this trigger if equipped to an entity. |
currentConfig | public TriggerConfig currentConfig { get; } | |
currentConfigChangeHandle | public AbilityTrigger.ChangedConfigHandle currentConfigChangeHandle { get; } | |
currentConfigCooldownTime | public float currentConfigCooldownTime { get; } | |
currentConfigCurrentCharge | public int currentConfigCurrentCharge { get; } | |
currentConfigCurrentMinimumDelay | public float currentConfigCurrentMinimumDelay { get; } | |
currentConfigIndex | public int currentConfigIndex { get; set; } | |
currentConfigMaxCooldownTime | public float currentConfigMaxCooldownTime { get; } | |
currentConfigUnscaledCooldownTime | public float currentConfigUnscaledCooldownTime { get; } | |
currentConfigUnscaledMaxCooldownTime | public float currentConfigUnscaledMaxCooldownTime { get; } | |
currentPassiveEffect | public StatusEffect currentPassiveEffect { get; } | |
fillAmount | public float fillAmount { get; set; } | |
ignoreRangeCheck | public bool ignoreRangeCheck { get; set; } | |
isDestroyedOnRoomChange | public override bool isDestroyedOnRoomChange { get; } | |
owner | public Entity owner { get; set; } |
Methods
Awake()
protected override void Awake()CanBeCast()
Can this ability be cast? By default this checks charges/delay/mana cost/self validator/self applied status effects.This must return same value for everyone to ensure consistency.
public virtual bool CanBeCast()Returns: bool
CanBeReserved()
Can this ability be reserved? By default this checks everything that CanBeCast() checks but self validators.This must return same value for everyone to ensure consistency.
public virtual bool CanBeReserved()Returns: bool
ChangeConfigTimed(int, float, Action<EventInfoAbilityInstance>, Action, bool)
public AbilityTrigger.ChangedConfigHandle ChangeConfigTimed(int index, float duration, Action<EventInfoAbilityInstance> onUse = null, Action onExpire = null, bool setFillAmount = true)Parameters:
| Name | Type | Description |
|---|---|---|
index | int | |
duration | float | |
onUse | System.Action<T><EventInfoAbilityInstance> | |
onExpire | System.Action | |
setFillAmount | bool |
Returns: AbilityTrigger.ChangedConfigHandle
ChangeConfigTimedOnce(int, float, Action<EventInfoAbilityInstance>, Action, bool)
public AbilityTrigger.ChangedConfigHandle ChangeConfigTimedOnce(int index, float duration, Action<EventInfoAbilityInstance> onUse = null, Action onExpire = null, bool setFillAmount = true)Parameters:
| Name | Type | Description |
|---|---|---|
index | int | |
duration | float | |
onUse | System.Action<T><EventInfoAbilityInstance> | |
onExpire | System.Action | |
setFillAmount | bool |
Returns: AbilityTrigger.ChangedConfigHandle
GetActorReadableName()
public override string GetActorReadableName()Returns: string
GetAnimationSpeed()
public virtual float GetAnimationSpeed()Returns: float
GetCastInfoToTarget(Entity)
public CastInfo GetCastInfoToTarget(Entity target)Parameters:
| Name | Type | Description |
|---|---|---|
target | Entity |
Returns: CastInfo
GetChannelDurationMultiplier()
public virtual float GetChannelDurationMultiplier()Returns: float
GetCooldownTimeMultiplier(int)
public virtual float GetCooldownTimeMultiplier(int configIndex)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int |
Returns: float
GetCooldownTimeMultiplierByAbilityHaste(float)
public static float GetCooldownTimeMultiplierByAbilityHaste(float abilityHaste)Parameters:
| Name | Type | Description |
|---|---|---|
abilityHaste | float |
Returns: float
GetCooldownTimeOffset(int)
public virtual float GetCooldownTimeOffset(int configIndex)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int |
Returns: float
GetInstanceSpawnPosition(int, CastInfo)
protected virtual Vector3 GetInstanceSpawnPosition(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
Returns: UnityEngine.Vector3
GetInstanceSpawnRotation(int, CastInfo)
protected virtual Quaternion? GetInstanceSpawnRotation(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
Returns: UnityEngine.Quaternion?
GetMaxCooldownTime(int, bool)
public float GetMaxCooldownTime(int configIndex, bool scaled = true)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
scaled | bool |
Returns: float
GetPostDelayDurationMultiplier()
public virtual float GetPostDelayDurationMultiplier()Returns: float
GetPredictedCastInfoToTarget(Entity, float)
public CastInfo GetPredictedCastInfoToTarget(Entity target, float strength)Parameters:
| Name | Type | Description |
|---|---|---|
target | Entity | |
strength | float |
Returns: CastInfo
GetPredictedCastInfoToTarget(Entity)
public CastInfo GetPredictedCastInfoToTarget(Entity target)Parameters:
| Name | Type | Description |
|---|---|---|
target | Entity |
Returns: CastInfo
IsConfigLocked(int)
public bool IsConfigLocked(int configIndex)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int |
Returns: bool
IsTargetInRange(Entity)
public bool IsTargetInRange(Entity target)Parameters:
| Name | Type | Description |
|---|---|---|
target | Entity |
Returns: bool
LockCooldown(int)
public void LockCooldown(int configIndex)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int |
LogicUpdate(float)
public override void LogicUpdate(float dt)Parameters:
| Name | Type | Description |
|---|---|---|
dt | float |
OnCastCancel(int, CastInfo)
Called on server when this ability's cast channel is canceled.By default, this sets the cooldown time to 1 second if its smaller than 1 second.
protected virtual void OnCastCancel(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
OnCastCancelSetCooldownTime(int, CastInfo)
protected virtual void OnCastCancelSetCooldownTime(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
OnCastComplete(int, CastInfo)
Called on server when this ability's cast channel is completed.By default, this spends mana and ability charge, sets the appropriate cooldown time, delay, and creates the configured ability instance using the owner's position and rotation.If the config is direction-type, the rotation will be based off of the cast direction.
public virtual AbilityInstance OnCastComplete(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
Returns: AbilityInstance
OnCastCompleteBeforePrepare(EventInfoCast)
public virtual void OnCastCompleteBeforePrepare(EventInfoCast cast)Parameters:
| Name | Type | Description |
|---|---|---|
cast | EventInfoCast |
OnCastCompleteSetCharge(int, CastInfo)
public virtual void OnCastCompleteSetCharge(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
OnCastCompleteSetCooldownTime(int, CastInfo)
public virtual void OnCastCompleteSetCooldownTime(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
OnCastCompleteSetMinimumDelay(int, CastInfo)
public virtual void OnCastCompleteSetMinimumDelay(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
OnCastCompleteSpendMana(int, CastInfo)
public virtual void OnCastCompleteSpendMana(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
OnCastStart(int, CastInfo)
Called on server when this ability is cast.By default, this plays the animation and starts the configured channel.IffaceForwardis set to true, it will cause the owner to rotate towards the target/point/direction/cursor position.Target validation will be done on the channel if the cast method is set to Target.
public virtual void OnCastStart(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
OnConfigChanged(int, int)
Called everywhere when current config index is changed or set initial value.
protected virtual void OnConfigChanged(int oldIndex, int newIndex)Parameters:
| Name | Type | Description |
|---|---|---|
oldIndex | int | |
newIndex | int |
OnCreate()
protected override void OnCreate()OnDeserialize(NetworkReader, bool)
public override void OnDeserialize(NetworkReader reader, bool initialState)Parameters:
| Name | Type | Description |
|---|---|---|
reader | Mirror.NetworkReader | |
initialState | bool |
OnEquip(Entity)
Called on everyone when the trigger is being equipped.
protected virtual void OnEquip(Entity newOwner)Parameters:
| Name | Type | Description |
|---|---|---|
newOwner | Entity |
OnRotateForward(int, CastInfo)
protected virtual void OnRotateForward(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
OnSerialize(NetworkWriter, bool)
public override void OnSerialize(NetworkWriter writer, bool initialState)Parameters:
| Name | Type | Description |
|---|---|---|
writer | Mirror.NetworkWriter | |
initialState | bool |
OnStartChannel(int, CastInfo)
protected virtual void OnStartChannel(int configIndex, CastInfo info)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
info | CastInfo |
OnStartServer()
public override void OnStartServer()OnStopServer()
public override void OnStopServer()OnUnequip(Entity)
Called on everyone when the trigger is being unequipped.
protected virtual void OnUnequip(Entity formerOwner)Parameters:
| Name | Type | Description |
|---|---|---|
formerOwner | Entity |
PredictAngle_Simple(float, Entity, Vector3, float)
public static float PredictAngle_Simple(float strength, Entity target, Vector3 startPos, float delay)Parameters:
| Name | Type | Description |
|---|---|---|
strength | float | |
target | Entity | |
startPos | UnityEngine.Vector3 | |
delay | float |
Returns: float
PredictAngle_SpeedAcceleration(float, Entity, Vector3, float, float, float, float, float)
public static float PredictAngle_SpeedAcceleration(float strength, Entity target, Vector3 startPos, float delay, float frontDistance, float initSpeed, float targetSpeed, float acceleration)Parameters:
| Name | Type | Description |
|---|---|---|
strength | float | |
target | Entity | |
startPos | UnityEngine.Vector3 | |
delay | float | |
frontDistance | float | |
initSpeed | float | |
targetSpeed | float | |
acceleration | float |
Returns: float
PredictPoint_Simple(float, Entity, float)
public static Vector3 PredictPoint_Simple(float strength, Entity target, float delay)Parameters:
| Name | Type | Description |
|---|---|---|
strength | float | |
target | Entity | |
delay | float |
Returns: UnityEngine.Vector3
PredictPoint_SpeedAcceleration(float, Entity, Vector3, float, float, float, float, float)
public static Vector3 PredictPoint_SpeedAcceleration(float strength, Entity target, Vector3 startPos, float delay, float frontDistance, float initSpeed, float targetSpeed, float acceleration)Parameters:
| Name | Type | Description |
|---|---|---|
strength | float | |
target | Entity | |
startPos | UnityEngine.Vector3 | |
delay | float | |
frontDistance | float | |
initSpeed | float | |
targetSpeed | float | |
acceleration | float |
Returns: UnityEngine.Vector3
PredictPointClamped_Simple(float, Entity, Vector3, float, float)
public static Vector3 PredictPointClamped_Simple(float strength, Entity target, Vector3 startPos, float range, float delay)Parameters:
| Name | Type | Description |
|---|---|---|
strength | float | |
target | Entity | |
startPos | UnityEngine.Vector3 | |
range | float | |
delay | float |
Returns: UnityEngine.Vector3
PredictPointClamped_SpeedAcceleration(float, Entity, Vector3, float, float, float, float, float, float)
public static Vector3 PredictPointClamped_SpeedAcceleration(float strength, Entity target, Vector3 startPos, float range, float delay, float frontDistance, float initSpeed, float targetSpeed, float acceleration)Parameters:
| Name | Type | Description |
|---|---|---|
strength | float | |
target | Entity | |
startPos | UnityEngine.Vector3 | |
range | float | |
delay | float | |
frontDistance | float | |
initSpeed | float | |
targetSpeed | float | |
acceleration | float |
Returns: UnityEngine.Vector3
PredictTime_SpeedAcceleration(Entity, Vector3, float, float, float, float, float)
public static float PredictTime_SpeedAcceleration(Entity target, Vector3 startPos, float delay, float frontDistance, float initSpeed, float targetSpeed, float acceleration)Parameters:
| Name | Type | Description |
|---|---|---|
target | Entity | |
startPos | UnityEngine.Vector3 | |
delay | float | |
frontDistance | float | |
initSpeed | float | |
targetSpeed | float | |
acceleration | float |
Returns: float
ProcessRange(float)
public virtual float ProcessRange(float original)Parameters:
| Name | Type | Description |
|---|---|---|
original | float |
Returns: float
ProcessReceivedCooldownReduction(ref CooldownReductionSettings, Actor)
public void ProcessReceivedCooldownReduction(ref CooldownReductionSettings data, Actor actor)Parameters:
| Name | Type | Description |
|---|---|---|
data | CooldownReductionSettings | |
actor | Actor |
ProcessReceivedCooldownReductionByRatio(ref CooldownReductionByRatioSettings, Actor)
public void ProcessReceivedCooldownReductionByRatio(ref CooldownReductionByRatioSettings data, Actor actor)Parameters:
| Name | Type | Description |
|---|---|---|
data | CooldownReductionByRatioSettings | |
actor | Actor |
SetCharge(int, int)
public void SetCharge(int configIndex, int charge)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
charge | int |
SetChargeAll(int)
public void SetChargeAll(int charge)Parameters:
| Name | Type | Description |
|---|---|---|
charge | int |
SetCooldownTime(int, float, bool)
public void SetCooldownTime(int configIndex, float time, bool scaled = true)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
time | float | |
scaled | bool |
SetCooldownTimeAll(float, bool)
public void SetCooldownTimeAll(float time, bool scaled = true)Parameters:
| Name | Type | Description |
|---|---|---|
time | float | |
scaled | bool |
SetMinimumDelay(int, float)
public void SetMinimumDelay(int configIndex, float delay)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int | |
delay | float |
SetMinimumDelayAll(float)
public void SetMinimumDelayAll(float delay)Parameters:
| Name | Type | Description |
|---|---|---|
delay | float |
ShouldTickCooldown(int)
If false, this trigger will not tick cooldowns by itself nor replenish charges. Delays will tick as usual. This should return same values in server and clients for consistent behavior.
protected virtual bool ShouldTickCooldown(int configIndex)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int |
Returns: bool
SyncCastMethodChanges(int)
public void SyncCastMethodChanges(int configIndex)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int |
UndoChangeConfig()
public void UndoChangeConfig()UnlockCooldown(int)
public void UnlockCooldown(int configIndex)Parameters:
| Name | Type | Description |
|---|---|---|
configIndex | int |