Bound sfx-emitters to scripts
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
void onStart()
|
||||
{
|
||||
|
||||
displayMessage("Track Loaded");
|
||||
//For green valley sheep test. See sheep_approach.as
|
||||
createTrigger("haybail_deactivate", 69.97 ,8.08 ,-107.84, 20.00); //follows xzy for now
|
||||
createTrigger("haybail",100.72, 10.20,-26.22 , 30.00);
|
||||
|
||||
TrackObject @t_obj = getTrackObject("cow");
|
||||
SoundEmitter @cowmoo = t_obj.getSoundEmitter();
|
||||
Vec3 newlocation = Vec3(0,2,5);
|
||||
cowmoo.move(newlocation);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,16 @@ namespace Scripting
|
||||
core::vector3df scale = core::vector3df(1, 1, 1);
|
||||
((TrackObjectPresentationMesh*)(memory))->move(xyz, hpr, scale);
|
||||
}
|
||||
void moveSound(Vec3 *new_pos, void *memory)
|
||||
{
|
||||
core::vector3df xyz = core::vector3df(0, 0, 0);
|
||||
xyz.X = new_pos->getX();
|
||||
xyz.Y = new_pos->getY();
|
||||
xyz.Z = new_pos->getZ();
|
||||
core::vector3df hpr = core::vector3df(0, 0, 0);
|
||||
core::vector3df scale = core::vector3df(1, 1, 1);
|
||||
((TrackObjectPresentationSound*)(memory))->move(xyz, hpr, scale);
|
||||
}
|
||||
void moveParticles(Vec3 *new_pos, void *memory)
|
||||
{
|
||||
core::vector3df xyz = core::vector3df(0, 0, 0);
|
||||
@@ -183,6 +193,10 @@ namespace Scripting
|
||||
r = engine->RegisterObjectMethod("TrackObject", "ParticleEmitter @getParticleEmitter()", asMETHOD(TrackObject, getParticles), asCALL_THISCALL); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("ParticleEmitter", "void move(Vec3 &in)", asFUNCTION(moveParticles), asCALL_CDECL_OBJLAST); assert(r >= 0);
|
||||
|
||||
//Sound Effect
|
||||
r = engine->RegisterObjectType("SoundEmitter", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("TrackObject", "SoundEmitter @getSoundEmitter()", asMETHOD(TrackObject, getSound), asCALL_THISCALL); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("SoundEmitter", "void move(Vec3 &in)", asFUNCTION(moveSound), asCALL_CDECL_OBJLAST); assert(r >= 0);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -143,10 +143,13 @@ public:
|
||||
template<typename T>
|
||||
const T* getPresentation() const { return dynamic_cast<T*>(m_presentation); }
|
||||
|
||||
//specialized getters for scripts
|
||||
TrackObjectPresentationMesh* getMesh(){ return getPresentation<TrackObjectPresentationMesh>(); }
|
||||
|
||||
TrackObjectPresentationParticles* getParticles(){ return getPresentation<TrackObjectPresentationParticles>(); }
|
||||
|
||||
TrackObjectPresentationSound* getSound(){ return getPresentation<TrackObjectPresentationSound>(); }
|
||||
|
||||
ThreeDAnimation* getAnimator() { return m_animator; }
|
||||
const ThreeDAnimation* getAnimator() const { return m_animator; }
|
||||
//Due to above overload AngelScript cannot decide which function to bind
|
||||
|
||||
Reference in New Issue
Block a user