Skip to main content

PowerStinger

A class in Root.Township, the global namespace.

Charged skill asset: hitting the target with a forward thrust dashes the player forward and damages up to a few things in a sphere cast along the way.

Constructors​

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

Fields​

13 private and internal fields
MemberWhat it is
private float damageMultiplierShare of the hit's damage dealt to each target (default 0.5).
private PositionRotationEvent executeEffectEvent run on clients with the hit position and rotation.
private LayerMask layerMaskLayers the sphere cast hits.
private float maxAngleFromForwardMinimum dot product between the hit and head forward (set in the inspector as an angle).
private int maxObjectsHitMost targets damaged by one thrust (default 5).
private float smoothLocomotionSpeedDash speed (default 10).
private float sphereCastRadiusRadius of the damage sphere cast.
private float stingerDistanceDash and sphere cast distance (default 2).
private ImpactChannel targetChannelImpact channel the tool needs.
private ImpactChannel[] targetChannelsImpact channels a hit object must have to be damaged.
private PooledObjectDefinition targetDefinitionPooled target shown to the player.
private float targetDistanceHow far in front of the head the target appears.
private float targetHeightFromeyeLevelTarget height relative to the eyes (default -0.2).

Methods​

MemberWhat it is
override void ExecuteOnClient(uint toolIdentifier, Vector3 position, Vector3 direction, Vector3 up, ImpactHitWithTool hit)Client: after reporting the hit, moves the smooth locomotion player forward over stingerDistance.
override void ExecuteWithHit(HeldPickupHandler handler, ImpactHitWithTool hitWithTool, bool hasHit = true)Sphere casts along the thrust and applies a hit to up to maxObjectsHit matching targets, skipping the player.
override bool ValidatePickup(HeldPickupHandler pickupHandler)True if the held item is a tool with targetChannel.
override bool ValidateTargetHit(ImpactHitWithTool hit)True if the base check passes and the hit points mostly forward from the head.
protected override PooledObject PlaceTarget()Client: places the target in front of the head on the horizontal plane.
protected override void SerializeInternal(Stream stream)When consumed, also sends the hit position and direction; clients play executeEffect there.
2 private and internal methods
MemberWhat it is
private IEnumerator LerpMove(SmoothLocomotionPlayerController smoothLocomotionPlayerController) (iterator)Coroutine that moves the player along the hit direction at smoothLocomotionSpeed, without gravity.
private void PositionTarget(Transform head, out Vector3 position, out Quaternion rotation)Works out the target position and rotation from the head's flattened forward direction.