Table of Contents

Class BlinkToHitTargetAction

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Blinks the caster to the character a hit struck, at a chosen place around it: in front, behind, to either side, or above. Wire it to an OnHit event (a "Blink On Hit" component); combine it with damage, a root, a knockback.

[Serializable]
public class BlinkToHitTargetAction : BaseAction, IAction
Inheritance
BlinkToHitTargetAction
Implements
Inherited Members

Remarks

Where. Placement in the Frame, Distance metres from the target's centre. The spot is found the way TeleportCasterAction finds a landing: a capsule of the caster's size is swept out from the target a step high, stops short of anything in the way, and is dropped onto the ground there. A side with no room (the target's back against a wall) gives way to the next side that has it (ResolveDestination(PhysicsScene, Vector3, float, Vector3, BlinkPlacement, float, float, float, int)), so the blink never lands inside a wall or inside the target. Above checks there is headroom over the target and falls back the same way when there is not. The caster is turned to face the target.

Server only, deliberately, like KnockbackHitAction's displacement. A hit is not run again when the owner replays a correction, so a predicted blink would be undone by every correction from before the hit and redone a round trip later: the caster would flicker between the two places. Moved by the server, the owner instead receives the new position in its next reconcile and is moved once, a round trip after the hit. A player moves through its motor (TeleportTo(Vector3, Quaternion)), an NPC through its brain (BlinkTo(Vector3, Quaternion), onto the NavMesh). Refused while rooted, incapacitated, dead or changing scene.

Effects play on every client at once, for the hit it saw: DepartFX where the caster is and ArriveFX where it will land, which on an observer is measured from the characters as it draws them.

Fields

ArriveFX

The effect played where the caster lands.

[Tooltip("Played where the caster lands.")]
public GameObject ArriveFX

Field Value

GameObject

DepartFX

The effect played where the caster leaves.

[Tooltip("Played where the caster leaves.")]
public GameObject DepartFX

Field Value

GameObject

Distance

Metres from the target's centre to the caster's (for Above: clearance over the target's head).

[Tooltip("Metres from the target's centre to the caster's. For Above, the gap over the target's head.")]
public float Distance

Field Value

float

FXHeight

Metres above the feet to play both effects.

public float FXHeight

Field Value

float

FXSize

Size of both effects in metres (effects are authored to a 1 m cube).

public float FXSize

Field Value

float

Frame

Which way is forward for the placement.

[Tooltip("TargetFacing: Behind = at the target's back. AttackDirection: Behind = the far side of the target from the caster.")]
public BlinkFrame Frame

Field Value

BlinkFrame

Placement

Where around the target to land.

[Tooltip("Where around the target to land.")]
public BlinkPlacement Placement

Field Value

BlinkPlacement

Methods

Execute(ICharacter, EventData)

Executes the action. Must be implemented by derived classes.

public override void Execute(ICharacter initiator, EventData eventData)

Parameters

initiator ICharacter

The character initiating the action.

eventData EventData

Event data for the action.

FrameForward(BlinkFrame, Vector3, Vector3, Vector3)

The frame's forward, flat: the target's facing, or (AttackDirection) the way from the target back toward the caster. The caster's own forward, reversed to face it, when that is undefined (standing on the target).

public static Vector3 FrameForward(BlinkFrame frame, Vector3 targetForward, Vector3 casterToTarget, Vector3 casterForward)

Parameters

frame BlinkFrame
targetForward Vector3
casterToTarget Vector3
casterForward Vector3

Returns

Vector3

PlacementDirection(BlinkPlacement, Vector3)

The flat direction from the target a horizontal placement lies in (zero for Above).

public static Vector3 PlacementDirection(BlinkPlacement placement, Vector3 forward)

Parameters

placement BlinkPlacement
forward Vector3

Returns

Vector3

ResolveDestination(PhysicsScene, Vector3, float, Vector3, BlinkPlacement, float, float, float, int)

Where the caster lands: the wanted placement if there is room for a body there, else the first side of FishMMO.Shared.BlinkToHitTargetAction.Fallbacks that has it, else the side with the most room.

public static Vector3 ResolveDestination(PhysicsScene physics, Vector3 targetFeet, float targetHeight, Vector3 forward, BlinkPlacement placement, float distance, float radius, float height, int layers)

Parameters

physics PhysicsScene
targetFeet Vector3
targetHeight float
forward Vector3
placement BlinkPlacement
distance float
radius float
height float
layers int

Returns

Vector3

StandOffDistance(float)

How far out from a target a ground landing stands when nothing says otherwise: clear of both bodies.

public static float StandOffDistance(float radius)

Parameters

radius float

Returns

float