Level class

The top-level level class.

Instances of this class are used to provide functionality to Game instances.

Implementers

Constructors

Level({required Game game, Map<String, Command>? commands, AssetReference? music, List<Ambiance>? ambiances, List<RandomSound>? randomSounds})
Create a level.
Level.fromStub(Game game, LevelStub stub, {Map<String, Command>? commands})
Create an instance from a level stub.

Properties

ambiancePlaybacks Map<Ambiance, SoundPlayback>
The playback settings for the list of ambiances.
final
ambiances List<Ambiance>
A list of ambiances for this level.
final
commandNextRuns List<NextRun<Command>>
The times before commands should run next.
final
commands Map<String, Command>
The commands this level recognises.
final
game Game
The game this level is part of.
final
hashCode int
The hash code for this object.
no setterinherited
music AssetReference?
The music for this level.
final
musicSound Sound?
The playing music.
getter/setter pair
random Random
The game's random sound generator.
no setter
randomSoundNextPlays List<NextRun<RandomSound>>
The times that randomSounds should play next.
final
randomSoundPlaybacks Map<RandomSound, SoundPlayback>
The playback settings for the list of randomSounds.
final
randomSounds List<RandomSound>
All the random sounds on this level.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stoppedCommands List<NextRun<Command>>
The old command next runs.
final

Methods

getCommandNextRun(Command command) NextRun<Command>?
Get the next run value for the given command.
getRandomSoundNextPlay(RandomSound randomSound) NextRun<RandomSound>
Get the next run for the given randomSound.
handleSdlEvent(Event event) → void
Handle an SDL event.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCover(Level other) → void
What should happen when this level is covered by another level.
onPop(double? fadeLength) → void
What should happen when this level is popped from a level stack.
onPush({double? fadeLength}) → void
What should happen when this level is pushed into a level stack.
onReveal(Level old) → void
What should happen when this level is revealed by another level being popped from on top of it.
registerCommand(String name, Command command) → void
Register a command on this level.
runCommand(Command command) → void
Run the given command.
scheduleRandomSound(RandomSound sound) → void
Schedule a random sound to play.
startCommand(String name) bool
Start the command with the given name.
stopCommand(String name) bool
Stop the command with the given name.
stopCommands(int timeDelta) → void
Remove any commands from the stoppedCommands list that can now be ran again.
stopPlayback(SoundPlayback playback) → void
Stop playback.
tick(int timeDelta) → void
Let this level tick.
tickCommands(int timeDelta) → void
Tick all commandNextRuns.
tickRandomSounds(int timeDelta) → void
Tick all random sounds.
toString() String
A string representation of this object.
inherited

Operators

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