Wwise SDK 2022.1.16
|
Game objects are entities to which elements such as interfaces, sounds, and triggers can be attached.
游戏对象被定义为 AkGameObjectID(无符号的
64 位字段)。您可以自由选择 ID,范围为 0 ~ 0xFFFFFFFFFFFFFFDF(作为有符号整数时为 -33)。 游戏对象 ID 范围 0xFFFFFFFFFFFFFFE0(-32)到 0xFFFFFFFFFFFFFFFF (-1) 是保留给内部使用的。transport 游戏对象,由设计工具注册,现在使用的游戏对象 ID 是 0xFFFFFFFFFFFFFFFE(-2)。
Every Event triggered in the sound engine is associated with a game object. All Event Actions are associated with the game object passed as a parameter of the AK::SoundEngine::PostEvent()
function, if they target a specific game object. If Event Actions do not target a game object, they ignore the game object specified. If an Action affects a single game object, but the game object specified in AK::SoundEngine::PostEvent()
is not valid, the Action is not executed.
Every game object can have an associated 3D position, a Switch for every existing Switch Group, an RTPC value for each RTPC, and multiple values (for example, a volume) that can be set on a specific item (Sound SFX, Actor-Mixer, bus, and so on) for a specific game object. 声音引擎一直存储着这些信息,直到与这些值相关的游戏对象被注销。
Before you can use game objects, you must register them. When you no longer need the game objects, unregister them. If you leave them registered, the memory used to store this information (3DPosition, RTPCs, Switches, and so on) is wasted.
AK::SoundEngine::RegisterGameObj()
函数存在两个版本:
以及
此函数的第二个版本用于监控目的。It displays the real name associated with objects that are playing. 在 AK_OPTIMIZED
模式下,第二个版本忽略对象名称。
You can use either of the following two functions to unregister game objects:
以及
AK::SoundEngine::UnregisterAllGameObj()
performs a complete clean-up of all parameters currently set for every game object and removes all game object associations. UnregisterGameObj()
does the same thing but only for a single game object. After a game object is unregistered, you must register it again before you can reuse it.
备注: Reusing game object IDs can lead to unreliable associations between game objects and names in the Wwise Profiler (see Profiling) because the Profiler only displays the most recently used name when the view is refreshed. |
For an example of game object integration, refer to 游戏对象示例.