Skip to content

Hitbox

Summary

This page summarizes all aspects of the hitbox system, which is responsible for transfering data between two bodies through collision detection.

Scripting

The code files in this section are at BeatEmUpTemplate/Assets/Scripting/Hitbox.

hitbox_scripting.png

Enums

These scripts contain groups of related constants that are meant to be used by other scripts. All classes in these folders use the enum keyword in their declaration.

HurtboxMask

classDiagram
    class HurtboxMask{
    <<Enum>>
    }

HurtboxMask.cs enumerates the possible HurtboxMasks a unit can have in the template. A unit's current HurtboxMask determines what HurtboxTypes a unit interacts with.

HurtboxType

classDiagram
    class HurtboxType{
    <<Enum>>
    }

HurtboxType.cs enumerates the possible types a Hurtbox can have in the template. Hitboxes only interact with Hurtboxes of specific types.

MonoBehaviours

These scripts are meant to be attached to GameObjects in the scene as components and inherit from Unity's MonoBehaviour class.

Hitboxes

classDiagram
    Hitbox <|-- JabHitbox
    Hitbox <|-- CrossHitbox
    class Hitbox{
        <<Abstract>>
    }

Hitboxes represent areas of an Ability that transmit data on collision with a Hurtbox.

Hitbox.cs defines what is common across all Hitboxes, regardless of game. This includes things like performing a boxcast in order to get information about how the hit occured.

JabHitbox.cs defines the hitbox for the Jab ability. This includes things like how it edits its JabAbilityData using information about the hit and the target.

CrossHitbox.cs defines the hitbox for the Cross ability. This includes things like how it edits its CrossAbilityData using information about the hit and the target.

HitDataEditors

classDiagram
    class HitDataEditor{
    }

HitDataEditors allow the user of an Ability a chance to edit its AbilityData pre and post hit.

HitDataEditor.cs represents a basic, general-purpose HitDataEditor used by the template. This component can be found attached to the Hitboxes GameObject under the Human prefab and its Hero and Villain prefab variants.

HitResponders

classDiagram
    class HitResponder{
    }

HitResponders respond when a unit's Hitbox triggers a collision with a Hurtbox.

HitResponder.cs represents a basic, general-purpose HitResponder used by the template. This component can be found attached to the Hitboxes GameObject under the Human prefab and its Hero and Villain prefab variants.

Hurtboxes

classDiagram
    class Hurtbox{
    }

Hurtboxes represent areas that trigger collisions with Hitboxes.

Hurtbox.cs defines what is common across all Hurtboxes, regardless of game. This includes things like having a class field that represents its HurtboxType.

HurtDataEditors

classDiagram
    class HurtDataEditor{
    }

HurtDataEditors allow the target of an Ability a chance to edit its AbilityData post hit.

HurtDataEditor.cs represents a basic, general-purpose HurtDataEditor used by the template. This component can be found attached to the Hurtboxes GameObject under the Human prefab and its Hero and Villain prefab variants.

HurtResponders

classDiagram
    class HurtResponder{
    }

HurtResponders respond when a unit's Hurtbox triggers a collision with a Hitbox.

HurtResponder.cs represents a basic, general-purpose HurtResponder used by the template. This component can be found attached to the Hurtboxes GameObject under the Human prefab and its Hero and Villain prefab variants.

UnitBehaviours

UnitBehaviours are components attached to a unit prefab that represents its functionality.

HurtboxMaskBehaviours
classDiagram
    class HurtboxMaskBehaviour{
    }

HurtboxMaskBehaviours describe the behaviour of a unit's HurtboxMask.

HurtboxMaskBehaviour.cs represents a basic, general-purpose HurtboxMaskBehaviour used by our template. This component can be found attached to the Human prefab and its Hero and Villain prefab variants. These prefabs are instantiated as children of the HumanPlayerUnitManager and AIPlayerUnitManager GameObjects in the Training scene at runtime.

Structs

These scripts contain user-defined data types that combine fields of different types underneath a single type. All classes in this folder use the struct keyword in their declaration.

HitPacket

classDiagram
    class HitPacket{
    <<Struct>>
    }

HitPacket.cs contains all the information involved in a hit, including the AbilityData being transferred.