source: GTP/trunk/App/Demos/Illum/Shark3D/version164x12u/IllumDemo/src/res/levelutil/actor/door.s3d_perch @ 2196

Revision 2196, 1.7 KB checked in by szirmay, 17 years ago (diff)
Line 
1///////////////////////////////////////////////////////////////////////////////
2//
3//      ##  ######
4//       ######  ###
5//  ## ###############        Shark 3D Engine (www.shark3d.com)
6//   ########## # # #
7//    ########                Copyright (c) 1996-2006 Spinor GmbH.
8//   ######### # # #          All rights reserved.
9//  ##   ##########
10//      ##
11//
12///////////////////////////////////////////////////////////////////////////////
13
14var int m_inside;       // Number of characters inside the sensor volume.
15var actor m_actu;       // Actuator to send the animation commands to.
16var actor m_speaker;    // Speaker used for playing the sound.
17
18func public void initActor()
19    m_inside = 0;
20    m_actu = findActor( getParamStr( "actu" ) );
21    m_speaker = findActor( getParamStr( "speaker" ) );
22end
23
24func public void finishActor()
25end
26
27// Open the door:
28func void open()
29    m_actu ^ play_to_end();
30    m_speaker ^ start();
31    var float duration = m_actu ^ float get_duration();
32    evtAppoint( "soundOff", duration );
33end
34
35// Close the door:
36func void close()
37    m_actu ^ play_to_start();
38    m_speaker ^ start();
39    var float duration = m_actu ^ float get_duration();
40    evtAppoint( "soundOff", duration );
41end
42
43// A character enters the sensor volume:
44func public void enter( actor sender )
45    if m_inside == 0 then
46        open();
47    end
48    m_inside = m_inside + 1;
49end
50
51// A character leaves the sensor volume:
52func public void leave( actor sender )
53    m_inside = m_inside - 1;
54    if m_inside == 0 then
55        close();
56    end
57end
58
59// Disable the sound:
60func public void soundOff()
61    m_speaker ^ stop();
62end
63
64///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.