-
Notifications
You must be signed in to change notification settings - Fork 4
Warning Task
Praneet Dhoolia edited this page Oct 17, 2023
·
9 revisions
The WarningTask is ran for 3 seconds to allow the WarningComponent to display an incoming mob warning.
The starting time is stored in a long startTime
variable. With every update, the task updates the owner's WarningComponent
, checks for the 3 second limit, and exits along with the component using the following methodology:
public void update() {
owner.getEntity().getComponent(WarningComponent.class).update();
if (ServiceLocator.getTimeSource().getTime() > startTime + 3000) {
owner.getEntity().dispose();
}
}