버전

menu_open

Quick Start Sample Integration - Game Objects

Game Object Example

For an overview of Game Objects, please refer to Concept: Game Object.

Game objects must be registered before you can use them to post events, set positions, and so on. The following code registers two game objects with predefined IDs. Note that you can use any 64-bit unsigned integer ID ranging from 0 to 0x‭FFFFFFFFFFFFFFDF you want, such as an incremented counter or an object pointer cast into an AkGameObjectID.

const AkGameObjectID GAME_OBJECT_ID_CAR = 100;
const AkGameObjectID GAME_OBJECT_ID_HUMAN = 200;
const AkGameObjectID GAME_OBJECT_ID_MARKERS = 300;

(...)

//
// Register game objects. Some global game objects might be registered
// at initialization time, but most of your game objects will probably
// be dynamically registered/unregistered as they appear/disappear in
// the game.
//

AK::SoundEngine::RegisterGameObj( GAME_OBJECT_ID_CAR, "Car" );
AK::SoundEngine::RegisterGameObj( GAME_OBJECT_ID_HUMAN, "Human" );
AK::SoundEngine::RegisterGameObj( GAME_OBJECT_ID_MARKERS, "MarkerTest" );

When a game object becomes obsolete, for example when the corresponding entities are removed from the game's world, you should unregister them to free up any resources that might be associated with them:

AK::SoundEngine::UnregisterGameObj( GAME_OBJECT_ID_CAR );
AK::SoundEngine::UnregisterGameObj( GAME_OBJECT_ID_HUMAN );
AK::SoundEngine::UnregisterGameObj( GAME_OBJECT_ID_MARKERS );

Refer to Integration Details - Game Objects for more information on game objects.

Note.gif
Note: This sample code comes from the Sound Engine Integration Sample Project available in the Samples section. Refer to Integration Demo Sample for more information.

이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요