ABILITY 02
Shield
Block damage and knockback while active, with configurable resistance and a shield visual.
Activation
ShieldButtonExample use
Explore the setup guide below to configure this ability.
Ability documentationCHARACTER ABILITY
SETUP GUIDE
Set up this ability
Component dependencies
| Component | Where to add or assign it | Purpose / setup |
|---|---|---|
| Health | Character GameObject | Required for damage and knockback protection. |
Visual component dependencies
These components support the associated effect. A missing optional visual does not by itself imply that the gameplay mechanic cannot run.
| Component | Where to add or assign it | Purpose / setup |
|---|---|---|
| ShieldVisual + SpriteRenderer | ShieldPrefab root | Required for the supplied shield visual. Assign BasicShield; create an Overlay Sorting Layer and arrange it above the character. Script: Assets/CorgiAddOns/Scripts/Abilities/ShieldVisual.cs. |
- Add CharacterShield to a CharacterPlus character with Health.
- Assign BasicShield to ShieldPrefab. Its root needs ShieldVisual and its hierarchy needs a SpriteRenderer.
- Create a Sorting Layer named Overlay and arrange it to render above the character.
- Set HitsResistance to 0 for no hit-count limit, or a positive count to request a break after that many OnHitZero events. Use ActiveTime for a duration.
- Activate with ShieldButton. DamageDisabled and ImmuneToKnockback are enabled while active, then reverted on stop.
Inspector reference
These are C# field declaration defaults. Existing prefab and scene values can override them. Shared fields are documented under Ability Configuration.
| Field | Type | Declared default |
|---|---|---|
HitsResistance | int | 0 |
ShieldPrefab | GameObject | Not assigned in declaration |
ShieldOffset | Vector3 | Vector3.zero |
AutoScaleWithCharacter | bool | true |
ShieldColor | Color | new Color(0.4f, 0.8f, 1f, 0.4f) |
PulseEnabled | bool | true |
PulseSpeed | float | 2f |
PulseMinAlpha | float | 0.2f |
PulseMaxAlpha | float | 0.6f |
HitFlashEnabled | bool | true |
HitFlashColor | Color | Color.white |
HitFlashDuration | float | 0.12f |
Usage notes
- Use the included BasicShield prefab as the starting point for your shield visual.
- When both inherited movement and condition blocking arrays are empty, initialization sets Jumping, WallClinging, Falling and WallJumping as blocked movement states.
- Hit resistance uses Health.OnHitZero events to count absorbed hits.
