TargetBasedSkill
An abstract class in Root.Township, the global namespace.
Base for charged tool skills that show a target on the struck object and fire when the player hits it, such as PowerStinger and PowerCrossSlash. The client reports the hit and the server runs the skill.
- Listed in Global namespace: T to X
- Inherits or implements
PickupBasedSkill - Derived types
PowerCrossSlash,PowerStinger - Nested types
ClientHitInput
Constructors
| Member | What it is |
|---|---|
protected TargetBasedSkill() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
| Member | What it is |
|---|---|
protected TargetBasedSkill.ClientHitInput clientHitInput | The last hit the client reported: position, direction, up, damage and impact type. |
4 private and internal fields
| Member | What it is |
|---|---|
private Dictionary<uint, ISkillInputMethod> activeHandlerMap | Active skill inputs by tool entity ID, so a client-reported hit can be matched to its input on the server. |
private Dictionary<uint, PooledObject> activeTargets | Pooled target markers shown on the local player's charged tools, by tool entity ID. |
private ImpactTypeFilter impactTypeFilter | Which tools and impact types this skill accepts. |
private bool isExecutingOnClient | Set while sending a client hit report, so the next message carries the hit instead of the base skill data. |
Methods
| Member | What it is |
|---|---|
virtual void ExecuteOnClient(uint toolIdentifier, Vector3 position, Vector3 direction, Vector3 up, ImpactHitWithTool hit) | Client: stores the hit position, direction and damage, removes the target and sends the skill message to the server. Called by SkillHitTarget. |
override void InputChangedState(bool isEnabled, ISkillInputMethod input) | Remembers or forgets the input method for the tool, so the server can find it when the client's hit arrives. |
override void SendSerializedMessage(IPlayer player, Stream stream) | Carries the client's hit input and tool ID. On the server it runs the skill for the matching input and resets that input. |
override bool ValidatePickup(HeldPickupHandler pickupHandler) | True if the base check passes, the held item is a tool, and its impact types pass the skill's filter. |
virtual bool ValidateTargetHit(ImpactHitWithTool hit) | True if the hit's impact type passes the skill's filter. |
protected override void EffectsRequested(NetworkEntity targetEntity, ToolBasedSkillStatus status, bool isLocalPlayer) | Clears any old target on the entity and, when the skill is charged for the local player, places a new hit target on it. |
protected abstract PooledObject PlaceTarget() | Spawns the pooled hit target object for this skill. |
Used in
Members of other types that take, return or hold a TargetBasedSkill: