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 List:
receiveCommand:
As you can see from the dependency graph, receiveCommand is the most required subcomponent.
receiveCommand adds to the unit:
-
Behavior Graph
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
Is responsible for:
-
Providing the IsMoving property
-
Listening for mouse clicks
-
Instantiating the moveIndicatorPrefab
-
Issuing the MoveToPoint and Follow commands to the
UnitCommandQueue -
Disabling the NavMeshAgent when the unit dies.
-
communicating the Unit’s speed and acceleration to the NavMeshAgent
beMoved:
-
Can receive force impulses.
-
While the unit is UNSTOPPABLE, movement will not occur from this sub-component.
-
Currently, the only source of a force impulse are Projectiles.
-
There is the global config option "BeMovedPushTime" for this in the TbeSceneSettings.
Requires: Rigidbody
autoAttack:
Can auto attack. The unit’s Weapon determines the auto attack that the unit uses.
requires: receiveCommand, a Weapon, an animation state named "Attack", a FirePoint.
cast:
Can cast. If you are giving executable Abilities to the unit, then this sub-component is required.
REQUIRES: receiveCommand, FirePoint.
showFloatingText:
Can display popup Text that indicates damage and healing (NYI: status effects).
There are two different prefabs for the text. They are in the folder: [TBE-root]/runtime/core/FloatingText.
One is the "normal" one and the other has the "Standalone" suffix. "Standalone" will be used if the unit has no displayLocalUI sub-component.
If you want to customize those prefabs, make variants of them and configure those variants in the "Prefabs" section of your TbeSceneSettings.
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
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.
-