Unit Sub-Components

There are optional Unit Sub-Components and the idea behind this is to be able to leave out stuff that is not needed. The naming of sub-components is designed so that one can say: "a unit can [subcomponent name]"

An example for Units that do not need any Sub-Components are Units that represent regular Items.

Unit Sub-Components Diagram:

diagram

Unit Sub-Components design:

The receiveCommand subcomponent is the most basic subcomponent, but it brings in most features. This is because of it’s intricate dependency graph.

Unit Sub-Components List:

receiveCommand:

As you can see from the dependency graph, receiveCommand is the most basic subcomponent.

receiveCommand adds to the unit:

One of the builtin commands is "Die" and that means that a unit without the receiveCommand component will (not receive damage and will) not die.

This component also observes the Units IsDead flag and if this becomes true AND the Unit is not unkillable, the "Die" command will be issued.

This also requires an Animator

moveSelf:

requires: receiveCommand

Adds: NavMeshAgent, MoveToClickPoint

beMoved

beMoved is NYI.

can be moved by forces from outside. While the unit is UNSTOPPABLE, this will be switched off.

Requires: Rigidbody???

autoAttack:

can auto attack. The auto attack itself is determined by the unit’s weapon.

requires: receiveCommand, a Weapon, an attack animation, a FirePoint.

cast:

can cast. What the unit can cast is determined by its Abilities.

REQUIRES: receiveCommand, FirePoint, castable Ability.

showFloatingText

can display popup Text that indicates damage and healing (NYI: status effects).

beSelected

Shows the Default Selected Indicator when the unit gets selected. The Default Selected Indicator can be configured in the Scene Settings of the TbeSystemManager

playAudio

has an audio source

REQUIRES: audio source

displayLocalUI

Display e.g. a healthbar over the unit’s head. It can either be displayed in ScreenSpace or World Space.

displayLocalUI requires receiveCommand because the LocalUI incorporates a castbar which in turn requires the unit to have the CommandQueue.

It has additional configuration options.

There are two premade prefabs for this UI:

  • unitHeadUi

    • comes with its own canvas. Meaning it can be attached to a GameObject e.g. Unit.

  • unitHeadUiNoCanvas

    • comes with no canvas. Meaning it must be attached to an already existing Canvas.

interact

can use other unit’s interact ability

REQUIRES: Interactor collider