/////////////////////////////////////////////////////////////////////////////// // // ## ###### // ###### ### // ## ############### Shark 3D Engine (www.shark3d.com) // ########## # # # // ######## Copyright (c) 1996-2007 Spinor GmbH. // ######### # # # All rights reserved. // ## ########## // ## // /////////////////////////////////////////////////////////////////////////////// var int m_inside; // Number of characters inside the sensor volume. var actor m_actu; // Actuator to send the animation commands to. var actor m_speaker; // Speaker used for playing the sound. func public void initActor() m_inside = 0; m_actu = findActor( getParamStr( "actu" ) ); m_speaker = findActor( getParamStr( "speaker" ) ); end func public void finishActor() end // Open the door: func void open() m_actu ^ play_to_end(); m_speaker ^ start(); var float duration = m_actu ^ float get_duration(); evtAppoint( "soundOff", duration ); end // Close the door: func void close() m_actu ^ play_to_start(); m_speaker ^ start(); var float duration = m_actu ^ float get_duration(); evtAppoint( "soundOff", duration ); end // A character enters the sensor volume: func public void enter( actor sender ) if m_inside == 0 then open(); end m_inside = m_inside + 1; end // A character leaves the sensor volume: func public void leave( actor sender ) m_inside = m_inside - 1; if m_inside == 0 then close(); end end // Disable the sound: func public void soundOff() m_speaker ^ stop(); end ///////////////////////////////////////////////////////////////////////////////