home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2008 January / Cybermycha 1_2008.iso / drappa / setup.exe / {app} / game / levels / Simus_mini / scripts / zapadnia.lcc < prev   
Encoding:
Text File  |  2005-08-18  |  1.7 KB  |  64 lines

  1. geCRenderableObject* g_pThis = 0;
  2. geCBaseNode* g_pNode = 0;
  3. float g_Rotation = 0.0f;
  4.  
  5. void FoundCollision( geCBaseNode* a_pNode )
  6. {
  7.      geCBaseNode* pPlayerNode = GameCore->GetRootNode()->GetNodeByName( String("GamePlayer") );
  8.      GameCore->SendMessage( String("collision_with_trap"), g_pNode->GetID(), pPlayerNode->GetID(), 100, 0 );
  9. }
  10.  
  11. // 1-15 opadanie (animation id = 1)
  12. // 15-60 powr≤t  (animation id = 2)
  13. float g_fStartWaiting =  0.0f;
  14. float g_fMaxOpenedTime = 1.0f;
  15. float g_fMaxClosedTime = 3.0f;
  16. void UpdateAnimation( geSUpdateArgument* a_pArg )
  17. {
  18.     switch( g_pThis->GetAnimations()->GetActive() )
  19.     {
  20.     case 1:
  21.             if( g_pThis->GetAnimations()->IsStopped() == 1 )
  22.                 { //w pe│ni otwarta klapa
  23.                     if( g_fStartwait
  24.                 g_pThis->GetAnimations()->SetActive( 2 );
  25.                 g_fStartTime = -1.0;
  26.                 g_fHiddenTime = float(geRandom(1, g_dwMaxHiddenTime));
  27.             }
  28.         break;
  29.     case 2:
  30.         if( g_pThis->GetAnimations()->IsStopped() == 1 ){
  31.             if( g_fStartTime < 0.0 )
  32.                 g_fStartTime = a_pArg->m_fCurrentTime;
  33.             if( g_fStartTime > 0.0 && a_pArg->m_fCurrentTime - g_fStartTime >= g_fHiddenTime ){
  34.                 g_fStartTime = -1.0;
  35.                 g_pThis->GetAnimations()->SetActive( 1 );
  36.                 g_fShowTime = float(geRandom(1, g_dwMaxShowTime));
  37.             }
  38.         }
  39.         break;
  40.     }
  41. }
  42.  
  43. void geCRenderableObject_Update( geSUpdateArgument* a_pArg )
  44. {
  45.  
  46.     if( g_pNode->IsFistTimeUpdate() == 1 )
  47.     {
  48.         return;
  49.     }
  50.     
  51.     UpdateAnimation( a_pArg );
  52.     
  53.     if( g_pThis->GetAnimations()->IsStopped() == 1 )
  54.     {
  55.         g_pThis->GetAnimations()->SetActive( 1 );
  56.     }
  57. }
  58.  
  59. void main( geCBaseNode* a_pNode )
  60. {
  61.     g_pNode = a_pNode;
  62.     g_pThis = GetRenderableObject( a_pNode );
  63. }
  64.