PickupBasedSkill
An abstract class in Root.Township, the global namespace.
Base for skills that work through a held tool, such as charged strikes. A per-player helper registers them when unlocked; their charge, cancel and execute states are sent as skill messages so every client can play the effects.
- Listed in Global namespace: P
- Inherits or implements
ProfessionSkill,IInputBasedSkill,IChargeableProfessionSkill - Derived types
SpecificPickupBasedSkill,AreaAttackSkill,EmberComposer,Gatherer,HeartCall,HebiosEnchant,MiningEcho,PowerHit,PowerStrike,SteelSong,TargetBasedSkill - Documented in Items, interaction and damage
Constructors
| Member | What it is |
|---|---|
protected PickupBasedSkill() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
| Member | What it is |
|---|---|
protected Chunk chunk | Chunk of the hit position in the last message. |
protected bool hasHitInformation | Whether the current message carries a hit position and rotation. |
protected Vector3 hitPosition | Hit position for the current message. |
protected Quaternion hitRotation | Rotation facing back along the hit direction, used for blade-aligned effects. |
protected uint pickupIdentifier | Entity id of the tool the current message is about. |
protected ToolBasedSkillStatus status | State being sent or received: charging started, charged, consumed or cancelled. |
14 private and internal fields
| Member | What it is |
|---|---|
private PositionRotationEvent hitPositionAndBladeAlignedEffect | Event invoked with the hit point and a rotation facing back along the hit, aligned to the blade, when the skill executes with a hit. |
private PositionEvent hitPositionEffect | Event invoked at the hit point when the skill executes with a hit. |
private SkillInputStructure inputStructure | Backing field for InputStructure. Also plays the sound for each status change. |
private TransformEvent localPlayerCanceledTransform | Like SkillCanceledTransform, but only for the player who used the skill. |
private TransformEvent localPlayerChargedTransform | Like SkillChargedTransform, but only for the player who used the skill. |
private TransformEvent localPlayerExecutedTransform | Like SkillExecutedTransform, but only for the player who used the skill. |
private PositionRotationEvent localPlayerHitPositionAndBladeAlignedEffect | Like hitPositionAndBladeAlignedEffect, but only for the player who used the skill. |
private PositionEvent localPlayerHitPositionEffect | Like hitPositionEffect, but only for the player who used the skill. |
private bool requiresHitInformation | Whether executing sends the hit point and rotation, so the hit effects can play. Defaults to true. |
private bool requiresLocalPlayerOnlyEffect | Whether the local-player-only events are used. |
private TransformEvent SkillCanceledTransform | Event invoked at the tool's transform on every client when the skill is cancelled. |
private TransformEvent SkillChargedTransform | Event invoked at the tool's transform on every client when the skill becomes charged. |
private TransformEvent SkillChargingStartedTransform | Event invoked at the tool's transform on every client when charging starts. |
private TransformEvent SkillExecutedTransform | Event invoked at the tool's transform on every client when the skill is used up. |
Properties
| Member | What it is |
|---|---|
SkillInputStructure InputStructure { get; } | The input pattern (SkillInputStructure) that charges and fires this skill. |
1 private and internal property
| Member | What it is |
|---|---|
private ProfessionSkill IInputBasedSkill.Skill { get; } | Explicit IInputBasedSkill property: returns this skill. |
Methods
| Member | What it is |
|---|---|
virtual void Deregister(ISkillInputMethod input) | Called when an input method for this skill is removed. Empty in the base. |
virtual void ExecuteWithHit(HeldPickupHandler handler, ImpactHitWithTool hitWithTool, bool hasHit = true) | Executes the skill from a tool hit, storing the hit point and blade rotation when hit information is needed, then sends Consumed. |
virtual void InputChangedState(bool isEnabled, ISkillInputMethod input) | Called when the skill's input turns on or off. Sends charged or cancelled for the held pickup. |
override void Lock(PlayerProgressionManager targetPlayer) | Also deregisters the skill from the player's tool skill helper once its level reaches 0. |
virtual void Register(HeldPickupHandler handler) | Called when a held pickup or input method is set up for this skill. Empty in the base. |
virtual void Register(ISkillInputMethod input) | Called when a held pickup or input method is set up for this skill. Empty in the base. |
void SendCancelled(NetworkEntity entity, Player player) | Sends a cancelled state for the tool entity to the player's chunks. |
void SendChargingStarted(NetworkEntity effectParentEntity, Player player) | Sends a charging started state for the tool entity. |
void SendConsumed(NetworkEntity entity, Player player) | Sends the executed (consumed) state, fires the skill executed event, then resets the status to cancelled. |
override void SendSerializedMessage(IPlayer player, Stream stream) | Reads or writes the skill message. On clients it waits for the tool entity to spawn, then plays the events, sounds and tool effect for the state. |
virtual void SetEffectActive(Pickup pickup, Player player, bool isEffectActive) | Sends a charged or cancelled state for the pickup to the player's chunks. |
override void Unlock(PlayerProgressionManager targetPlayer) | Also registers the skill with the player's tool skill helper the first time it is unlocked. |
virtual bool ValidateExecutionHit(ProgressionPath path, ImpactHitWithTool hitWithTool) | Whether a path hit should execute the skill. The base returns false, so subclasses must override it. |
virtual bool ValidatePickup(HeldPickupHandler pickupHandler) | Whether a held pickup can use this skill. The base allows any. |
protected virtual void EffectsRequested(NetworkEntity targetEntity, ToolBasedSkillStatus status, bool isReadingForCastingPlayer) | Hook for subclasses, called on clients after the state's effects play for the tool entity. |
protected virtual Transform GetTransformToCallAt(ToolBasedSkillStatus status, NetworkEntity entity) | Where the effect events play. The base uses the tool entity's transform. |
protected virtual void SerializeInternal(Stream stream) | Hook for subclasses to add their own data to the skill message. |
Used in
Members of other types that take, return or hold a PickupBasedSkill:
BlockingCharge.IStrikeSuccessionModifier.TargetSkill, BlockingCharge.modifiedSkill, IStrikeSuccessionModifier.TargetSkill, PickupBasedSkillModifier.modifiedSkill, PickupBasedSkillModifier.ModifiedSkill, PlayerToolBasedSkillHelper.activeSkills, PlayerToolBasedSkillHelper.DeregisterSkill, PlayerToolBasedSkillHelper.RegisterSkill, PowerStrike.IStrikeSuccessionModifier.TargetSkill, StrikeSuccessionInput.skill.