Skip to main content

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.

Constructors​

MemberWhat it is
protected PickupBasedSkill()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

MemberWhat it is
protected Chunk chunkChunk of the hit position in the last message.
protected bool hasHitInformationWhether the current message carries a hit position and rotation.
protected Vector3 hitPositionHit position for the current message.
protected Quaternion hitRotationRotation facing back along the hit direction, used for blade-aligned effects.
protected uint pickupIdentifierEntity id of the tool the current message is about.
protected ToolBasedSkillStatus statusState being sent or received: charging started, charged, consumed or cancelled.
14 private and internal fields
MemberWhat it is
private PositionRotationEvent hitPositionAndBladeAlignedEffectEvent 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 hitPositionEffectEvent invoked at the hit point when the skill executes with a hit.
private SkillInputStructure inputStructureBacking field for InputStructure. Also plays the sound for each status change.
private TransformEvent localPlayerCanceledTransformLike SkillCanceledTransform, but only for the player who used the skill.
private TransformEvent localPlayerChargedTransformLike SkillChargedTransform, but only for the player who used the skill.
private TransformEvent localPlayerExecutedTransformLike SkillExecutedTransform, but only for the player who used the skill.
private PositionRotationEvent localPlayerHitPositionAndBladeAlignedEffectLike hitPositionAndBladeAlignedEffect, but only for the player who used the skill.
private PositionEvent localPlayerHitPositionEffectLike hitPositionEffect, but only for the player who used the skill.
private bool requiresHitInformationWhether executing sends the hit point and rotation, so the hit effects can play. Defaults to true.
private bool requiresLocalPlayerOnlyEffectWhether the local-player-only events are used.
private TransformEvent SkillCanceledTransformEvent invoked at the tool's transform on every client when the skill is cancelled.
private TransformEvent SkillChargedTransformEvent invoked at the tool's transform on every client when the skill becomes charged.
private TransformEvent SkillChargingStartedTransformEvent invoked at the tool's transform on every client when charging starts.
private TransformEvent SkillExecutedTransformEvent invoked at the tool's transform on every client when the skill is used up.

Properties​

MemberWhat it is
SkillInputStructure InputStructure { get; }The input pattern (SkillInputStructure) that charges and fires this skill.
1 private and internal property
MemberWhat it is
private ProfessionSkill IInputBasedSkill.Skill { get; }Explicit IInputBasedSkill property: returns this skill.

Methods​

MemberWhat 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: