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.
- Listed in Global namespace: P
- Inherits or implements
TargetBasedSkill - Attributes
CreateAssetMenu
Constructors
| Member | What it is |
|---|---|
PowerStinger() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
13 private and internal fields
| Member | What it is |
|---|---|
private float damageMultiplier | Share of the hit's damage dealt to each target (default 0.5). |
private PositionRotationEvent executeEffect | Event run on clients with the hit position and rotation. |
private LayerMask layerMask | Layers the sphere cast hits. |
private float maxAngleFromForward | Minimum dot product between the hit and head forward (set in the inspector as an angle). |
private int maxObjectsHit | Most targets damaged by one thrust (default 5). |
private float smoothLocomotionSpeed | Dash speed (default 10). |
private float sphereCastRadius | Radius of the damage sphere cast. |
private float stingerDistance | Dash and sphere cast distance (default 2). |
private ImpactChannel targetChannel | Impact channel the tool needs. |
private ImpactChannel[] targetChannels | Impact channels a hit object must have to be damaged. |
private PooledObjectDefinition targetDefinition | Pooled target shown to the player. |
private float targetDistance | How far in front of the head the target appears. |
private float targetHeightFromeyeLevel | Target height relative to the eyes (default -0.2). |
Methods
| Member | What 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
| Member | What 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. |