home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 56 / CDPowerplay56Disc2.iso / demos / blade / data1.cab / Program_Executable_Files / Lib / OnOff.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-10-27  |  4.0 KB  |  99 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import AuxFuncs
  5. import Bladex
  6. LightDictionary = { }
  7. LightSpeed = 0.02
  8. LightSetInens = 130.0
  9. LightSetRadius = 0.03
  10. LightSetColor = (255, 165, 64)
  11.  
  12. def AddLightData(objname, Inens = LightSetInens, Radius = LightSetRadius, Color = LightSetColor):
  13.     if not LightDictionary.has_key(objname):
  14.         LightDictionary[objname] = (Inens, Radius, Color)
  15.     
  16.  
  17.  
  18. def GetLightData(objname):
  19.     global LightSetInens, LightSetRadius, LightSetColor
  20.     if LightDictionary.has_key(objname):
  21.         LightSetInens = LightDictionary[objname][0]
  22.         LightSetRadius = LightDictionary[objname][1]
  23.         LightSetColor = LightDictionary[objname][2]
  24.     
  25.  
  26.  
  27. def SetLightSpeed(xxx):
  28.     global LightSpeed
  29.     LightSpeed = xxx
  30.  
  31.  
  32. def SetLightInens(xxx):
  33.     global LightSetInens
  34.     LightSetInens = xxx
  35.  
  36.  
  37. def SetLightRadius(xxx):
  38.     global LightSetRadius
  39.     LightSetRadius = xxx
  40.  
  41.  
  42. def SetLightIntesity(LightName, Intens):
  43.     o = Bladex.GetEntity(LightName)
  44.     o.Lights = [
  45.         (LightSetInens * Intens, LightSetRadius, LightSetColor)]
  46.     o.FiresIntensity = [
  47.         20 - 20 * Intens]
  48.  
  49.  
  50. def GetLightIntesity(LightName):
  51.     o = Bladex.GetEntity(LightName)
  52.     spot = AuxFuncs.GetSpot(o)
  53.     spot.SizeFactor = spot.Intensity / LightSetInens
  54.     return spot.Intensity / LightSetInens
  55.  
  56. Bladex.CreateTimer('LightTimer', 0.2)
  57.  
  58. def TurnOffTimer(e_name, time):
  59.     Intesity = GetLightIntesity(e_name) - LightSpeed * 4
  60.     if Intesity <= 0:
  61.         o = Bladex.GetEntity(e_name)
  62.         o.TimerFunc = ''
  63.         o.RemoveFromList('LightTimer')
  64.         Intesity = 0
  65.     
  66.     SetLightIntesity(e_name, Intesity)
  67.  
  68.  
  69. def TurnOffLight(LightName):
  70.     o = Bladex.GetEntity(LightName)
  71.     o.SubscribeToList('LightTimer')
  72.     o.TimerFunc = TurnOffTimer
  73.  
  74.  
  75. def TurnOnTimer(e_name, time):
  76.     global LightSetInens, LightSetRadius
  77.     AuxLightSetInens = LightSetInens
  78.     AuxLightSetRadius = LightSetRadius
  79.     GetLightData(e_name)
  80.     Intesity = GetLightIntesity(e_name) + LightSpeed * 4
  81.     if Intesity >= 1:
  82.         o = Bladex.GetEntity(e_name)
  83.         o.TimerFunc = ''
  84.         o.RemoveFromList('LightTimer')
  85.         Intesity = 1
  86.     
  87.     SetLightIntesity(e_name, Intesity)
  88.     LightSetInens = AuxLightSetInens
  89.     LightSetRadius = AuxLightSetRadius
  90.  
  91.  
  92. def TurnOnLight(LightName):
  93.     GetLightData(LightName)
  94.     AddLightData(LightName, LightSetInens, LightSetRadius, LightSetColor)
  95.     o = Bladex.GetEntity(LightName)
  96.     o.SubscribeToList('LightTimer')
  97.     o.TimerFunc = TurnOnTimer
  98.  
  99.