home *** CD-ROM | disk | FTP | other *** search
/ Game Level Design / GLDesign.bin / Software / UnrealEngine2Runtime / UE2Runtime-22262001_Demo.exe / Gameplay / Classes / ACTION_FadeView.uc < prev    next >
Text File  |  2003-12-11  |  1KB  |  46 lines

  1. class ACTION_FadeView extends LatentScriptedAction;
  2.  
  3. var(Action) float FadeTime;
  4. var(Action) vector TargetFlash;
  5.  
  6. function bool InitActionFor(ScriptedController C)
  7. {
  8.  
  9.     return true;    
  10. }
  11.  
  12. function string GetActionString()
  13. {
  14.     return ActionString@FadeTime;
  15. }
  16.  
  17.  
  18. function bool TickedAction()
  19. {
  20.     return true;
  21. }
  22.  
  23. function bool StillTicking(ScriptedController C, float DeltaTime)
  24. {
  25.     local bool bXDone,bYDone,bZDone;
  26.     local vector V;
  27.  
  28.     V = C.GetInstigator().PhysicsVolume.ViewFlash - (C.Instigator.PhysicsVolume.Default.ViewFlash - TargetFlash) * (DeltaTime/FadeTime);
  29.  
  30.     if( V.X < TargetFlash.X ) { V.X = TargetFlash.X; bXDone = True; }
  31.     if( V.Y < TargetFlash.Y ) { V.Y = TargetFlash.Y; bYDone = True; }
  32.     if( V.Z < TargetFlash.Z ) { V.Z = TargetFlash.Z; bZDone = True; }
  33.  
  34.     C.GetInstigator().PhysicsVolume.ViewFlash = V;
  35.  
  36.     if(bXDone && bYDone && bZDone)
  37.         return false;
  38.     return true;
  39. }
  40.  
  41. defaultproperties
  42. {
  43.     TargetFlash=(X=-2,Y=-2,Z=-2)
  44.     FadeTime=+5
  45.     ActionString="fade view"
  46. }