home *** CD-ROM | disk | FTP | other *** search
/ Singles (French) / Singles-FrenchVersion-Win95.iso / data1.cab / Statemachine / autoDestruct.lua < prev    next >
Text File  |  2004-03-05  |  561b  |  27 lines

  1. -- pool state machine
  2.  
  3. beginStateMachine()
  4.  
  5.  
  6.     onEnter(function(msg)
  7.         print("autoDestruct onEnter: " .. getType());
  8.         local lifeTime = tonumber(readConfig("Game", "lifeTime" .. getType(), tostring(DEFAULT_LIFE_TIME)));
  9.         if (lifeTime) then
  10.             print(" >lifeTime: " .. lifeTime);
  11.             sendDelayedMsg("autoDestruct", this, lifeTime);
  12.         else
  13.             print(" >lifeTime undefined");
  14.         end
  15.     end )
  16.  
  17.  
  18.     onMsg("autoDestruct", function(msg)
  19.         print("autoDestruct time is up: " .. getType());
  20.         this.deleteGameObject();    
  21.     end )
  22.     
  23.  
  24.     
  25.             
  26. endStateMachine()
  27.