Skip to main content

PowerWorld

PowerWorld is the central hub for Power's runtime systems: Diplomacy (teams and relations), the Updater (durations, delays, generators, tweens) and Logging.

Every scene that runs Power needs one. Add the PowerWorld component to a GameObject, assign its settings and turn on Initialize On Load (it is an Actor, see below).

Fields​

FieldDescription
SettingsThe PowerWorldSettings asset: the Updaters (one UpdaterModel per Updater Type, e.g. Realtime and Turnbased), the Diplomacy Settings and the Log Settings.
Diplomacy DefinitionThe starting teams and relations.
Actor fieldsPowerWorld derives from Actor, so it also has a Stat Repository, an Effect Process Definition, Extensions, Initialize On Load…

Create › Power › World › World Settings creates the settings asset.

The world is an Actor​

PowerWorld is itself an ActorEntity. Give it a Stat Repository and an Effect Process Definition and it can hold Stats like any Actor. Effects reach it with the World Effect Target, and Stat From / Interaction Actor World read its Stats.

Use it for global state: a match timer, a wave counter, how many enemies are poisoned (a count kept up to date by a State Based Effect on each poisoned Actor). The General Expansions extension PowerWorldExtension_TeamMemberCountSync keeps one member-count Stat per team on it.

Static API​

MemberDescription
PowerWorld.InstanceThe PowerWorld of the scene.
PowerWorld.DiplomacyTeams and relations: AddTeam, RemoveTeam, AddMember(actor, teamId), RemoveMember, GetTeamMembers(teamFlags, filter), UpdateDiplomacy(teamA, teamB, relation); events TeamAdded, TeamRemoved, MemberAdded, MemberRemoved. Only members can be found by Relation State and Team Flags targeting.
PowerWorld.UpdaterThe world updater that advances durations, delays, Generators and Tweeners.
PowerWorld.GetActor(actorId) / TryGetActor(actorId, out actor)The live Actor with a static Actor Id (its Predefined Instance Id), or null.
PowerWorld.StaticActorsEvery live Actor with a static Actor Id, by id.
PowerWorld.ActorRegisteredRaised when an Actor with a static Actor Id finished initializing.
PowerWorld.Root / SetRoot(transform)The transform spawned objects are parented to.
PowerWorld.InputCamera / SetInputCamera(camera)The camera input is read through (used by samples' pointer / targeting code).
PowerWorld.OnUpdate, OnClearRaised every world update and when the world is cleared.