ZoneLevel class

A level for playing through a zone.

Constructors

ZoneLevel({required WorldContext worldContext, required Zone zone, double initialHeading = 0.0, Point<double> coordinates = _origin, WalkingDirection walkingDirection = WalkingDirection.forwards, int timeSinceLastWalked = 1000000})
Create an instance.

Properties

affectedInterfaceSounds → SoundChannel
The sound channel to use for affected interface sounds.
final
ambiancePlaybacks Map<Ambiance, SoundPlayback>
The playback settings for the list of ambiances.
finalinherited
ambiances List<Ambiance>
A list of ambiances for this level.
finalinherited
boxReverbs Map<String, CreateReverb>
The loaded reverbs.
final
commandNextRuns List<NextRun<Command>>
The times before commands should run next.
finalinherited
commands Map<String, Command>
The commands this level recognises.
finalinherited
coordinates Point<double>
Get the player's current coordinates.
getter/setter pair
coordinatesOffset Point<int>
The difference between the origin and the minimum coordinates from boxes.
no setter
currentTerrain Terrain
The current terrain.
getter/setter pair
currentWalkingOptions WalkingOptions?
The current walking options.
getter/setter pair
game → Game
The game this level is part of.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
heading double
Get the player's current heading.
getter/setter pair
music → Music?
The music for this level.
finalinherited
musicSound ↔ PlaySound?
The playing music.
getter/setter pairinherited
npcContexts List<NpcContext>
The NPC contexts to use.
final
objects List<List<String?>>
The objects that have been loaded from the zone.
no setter
randomSoundNextPlays List<NextRun<RandomSound>>
The times that randomSounds should play next.
finalinherited
randomSoundPlaybacks Map<RandomSound, SoundPlayback>
The playback settings for the list of randomSounds.
finalinherited
randomSounds List<RandomSound>
All the random sounds on this level.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Point<int>
The coordinates of the northeast-most point of this level.
no setter
stoppedCommands List<NextRun<Command>>
The old command next runs.
finalinherited
tiles List<List<String?>>
The loaded tiles.
no setter
timeSinceLastWalked int
The number of milliseconds since the walk method was called.
getter/setter pair
turnAmount double?
The amount to add to the heading each tick.
getter/setter pair
walkingDirection WalkingDirection
The direction the player is walking in.
getter/setter pair
walkingMode WalkingMode
The speed the player is currently walking at.
no setter
worldContext WorldContext
The world context to use.
final
zone Zone
The zone to use.
final
zoneObjectAmbiances Map<String, SoundPlayback>
The zone object ambiances that are playing.
final
zoneObjectSoundChannels Map<String, SoundChannel>
The sound channels for all the ZoneObjects.
final

Methods

destroyNpcSounds() → void
Stop all NPC sounds.
destroyZoneObjectSounds() → void
Destroy every channel in zoneObjectSoundChannels.
getBox([Point<double>? where]) Box?
Get the box that resides at the provided coordinates.
getCommandNextRun(Command command) → NextRun<Command>?
Get the next run value for the given command.
inherited
getLookAroundObjects() List<LookAroundObject>
Get the objects within visual range of the player.
getRandomSoundNextPlay(RandomSound randomSound) → NextRun<RandomSound>
Get the next run for the given randomSound.
inherited
getZoneObject([Point<double>? where]) ZoneObject?
Get the zone object at the given position.
getZoneObjectSoundChannel(ZoneObject object) → SoundChannel
Get a valid sound channel for the given object.
handleNpcCallCommand({required CallCommand callCommand, required Npc npc, required Box? box, required SoundChannel channel, required Point<int> coordinates}) → void
Handle the given callCommand in the context of the given npc.
handleSdlEvent(Event event) → void
Handle SDL events.
lookAround() → void
Look around.
maybeWalk(int timeDelta) → void
Start walking if the time is right.
moveNpc(NpcContext context) → void
Move the npc with the given context.
moveNpcs(int timeDelta) → void
Move the NPC's identified by npcContexts.
moveTo({required Point<double> destination, bool updateLastWalked = true, bool runWalkCommand = true}) Box?
Move directly to the given destination.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCover(Level other) → void
This zone has been covered, probably by a PauseMenu instance.
onPop(double? fadeLength) → void
Destroy all the created reverbs, and the sound channel.
onPush() → void
Set the listener position ETC.
onReveal(Level old) → void
Reset state.
playZoneObjectAmbiances() → void
Start all zone object ambiances playing.
registerCommand(String name, Command command) → void
Register a command on this level.
inherited
resetState() → void
Reset state.
runCommand(Command command) → void
Run the given command.
inherited
scheduleRandomSound(RandomSound sound) → void
Schedule a random sound to play.
inherited
setReverb(Box? box) → void
Set the reverb for the affectedInterfaceSounds.
showCoordinates() → void
Show the current coordinates.
showFacing() → void
Show the facing direction.
startCommand(String name) bool
Start the command with the given name.
inherited
startWalking() → void
Start walking.
stopCommand(String name) bool
Stop the command with the given name.
inherited
stopPlayback(SoundPlayback playback) → void
Stop playback.
inherited
stopWalking() → void
Stop walking.
tick(Sdl sdl, int timeDelta) Future<void>
Maybe walk.
toString() String
A string representation of this object.
inherited
walk(WalkingOptions options) Box?
Walk a bit.

Operators

operator ==(Object other) bool
The equality operator.
inherited