Team Game Mechanic
Team Mechanic
The TeamMechanic is one of the built-in GameMechanics bundled with the Studio SDK. This mechanic allows you to
create GameTeams, assign them names, and have LivingEntitys join the created teams. Additionally, TeamAssigners
allow for the assignment of groups to available teams based on predefined behavior using
the assignTeams(Collection<LivingEntity>, TeamAssigner) method.
Team Assigner Factory
A TeamAssignerFactory provides for the dynamic construction of instances of a specific TeamAssigner. To function,
the factory needs to be registered in the TeamMechanic using
the registerTeamAssignerFactory(Class<T extends TeamAssigner>, TeamAssignerFactory<T>) method. Once the factory has
been registered, you can use the TeamMechanic to construct instances of the TeamAssigner using
the constructTeamAssigner(Class<T extends TeamAssigner>) method. All built-in TeamAssigners that we provide have
their factories pre-registered in the TeamMechanic, so all you have to do is construct an instance when you want to
use them. You do not need to create a TeamAssignerFactory for your own custom TeamAssigners, but you can if you'd
like to. You will need to implement your own TeamAssignerFactory if you plan to sell source-unavailable TeamAssigner
s to other developers on our asset marketplace. We currently provide two built-in TeamAssigners:
SingleTeamAssigner- groups allLivingEntitys into the single team in theTeamMechanicEvenTeamsAssigner- assigns allLivingEntitys to teams in the most even way possible. Can be configured withsetShouldGroupParties(boolean)to attempt to put parties on the same team if they fit