Class Soundscape
A soundscape is a set of background/ambient sounds that play to enhance the atmosphere of the game. To create a new soundscape, it can be added to Soundscapes.
public class Soundscape
- Inheritance
-
Soundscape
- Inherited Members
- Extension Methods
Constructors
Soundscape(IntensityDelegate, params SoundEffect[])
Creates a new soundscape with the given settings.
public Soundscape(Soundscape.IntensityDelegate intensityFunction, params SoundEffect[] sounds)
Parameters
intensityFunctionSoundscape.IntensityDelegateThe intensity function that determines the intensity of this soundscape at any given position.
soundsSoundEffect[]The set of sound effects that this soundscape should contain, which will be randomly chosen from.
Fields
IntensityFunction
The intensity function that determines the intensity of this soundscape at any given position.
public readonly Soundscape.IntensityDelegate IntensityFunction
Field Value
Sounds
The set of sound effects that this soundscape should contain, which will be randomly chosen from.
public readonly SoundEffect[] Sounds
Field Value
- SoundEffect[]
Soundscapes
The set of soundscapes that are active in the game. To create a new soundscape and to have its Update(Map, Camera) method called while in-game, it can be added to this collection.
public static readonly List<Soundscape> Soundscapes
Field Value
Methods
GetDaytimePercentage(Map)
Returns a number between 0 and 1 that determines how bright the sun currently is, based on the passed Map's Time.
public static float GetDaytimePercentage(Map map)
Parameters
mapMapThe map.
Returns
- float
The daytime percentage.
GetObjectDensity<T>(Map, Vector2, Func<T, bool>, int, int)
Returns a value between 0 and 1 that represents the density of objects of a certain type around a certain position.
public static float GetObjectDensity<T>(Map map, Vector2 cameraWorldPos, Func<T, bool> predicate, int maxDistance, int maxAmount) where T : MapObject
Parameters
mapMapThe map.
cameraWorldPosVector2The position in the world that the density calculation should be centered around.
predicateFunc<T, bool>A predicate that determines whether objects should count towards the density calculation.
maxDistanceintThe maximum distance around the
cameraWorldPos.maxAmountintThe maximum amount of objects that match the
predicatebefore the returned value is capped to 1.
Returns
- float
The density.
Type Parameters
TThe type of object to match.
GetTileDensity(Map, Vector2, Func<Tile, bool>, int, int)
Returns a value between 0 and 1 that represents the density of tiles of a certain type around a certain position.
public static float GetTileDensity(Map map, Vector2 cameraWorldPos, Func<Tile, bool> predicate, int maxDistance, int maxAmount)
Parameters
mapMapThe map.
cameraWorldPosVector2The position in the world that the density calculation should be centered around.
predicateFunc<Tile, bool>A predicate that determines whether tiles should count towards the density calculation.
maxDistanceintThe maximum distance around the
cameraWorldPos.maxAmountintThe maximum amount of tiles that match the
predicatebefore the returned value is capped to 1.
Returns
- float
The density.
Update(Map, Camera)
Updates this soundscape, querying its intensity function and playing its sound effects.
public virtual void Update(Map map, Camera camera)
Parameters
mapMapThe map that the soundscape should play on.
cameraCameraThe game's camera.