home *** CD-ROM | disk | FTP | other *** search
/ Game Level Design / GLDesign.bin / Software / UnrealEngine2Runtime / UE2Runtime-22262001_Demo.exe / Runtime / Classes / RTPawn.uc < prev    next >
Text File  |  2003-10-16  |  4KB  |  170 lines

  1. //=============================================================================
  2. // RTPawn
  3. //=============================================================================
  4.  
  5. class RTPawn extends Pawn;
  6.  
  7. var ShadowProjector Shadow; // Warning override of Pawn variable because the pawn Shadow is just a projector
  8.  
  9. var globalconfig bool bPlayerShadows;
  10. var globalconfig bool bBlobShadow;
  11.  
  12. event TakeDamage( int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType)
  13. {
  14.     // Never take damage or die
  15. }
  16.  
  17. // Called whenever a player changes their movement type.
  18. simulated function PlayMoving()
  19. {
  20.     if ( (Physics == PHYS_None) 
  21.         || ((Controller != None) && Controller.bPreparingMove) )
  22.     {
  23.         // bot is preparing move - not really moving 
  24.         PlayWaiting();
  25.         return;
  26.     }
  27.     if ( Physics == PHYS_Walking )
  28.     {
  29.         if ( bIsCrouched )
  30.         {
  31.             AnimateCrouchWalking();
  32.         }
  33.         else if ( bIsWalking )
  34.         {
  35.             AnimateWalking();
  36.         }
  37.         else
  38.         {
  39.             AnimateRunning();
  40.         }
  41.     }
  42.     else if ( (Physics == PHYS_Swimming)
  43.         || ((Physics == PHYS_Falling) && TouchingWaterVolume()) )
  44.         AnimateWalking();
  45.     else if ( Physics == PHYS_Ladder )
  46.         AnimateWalking();
  47.     else if ( Physics == PHYS_Flying )
  48.         AnimateFlying();
  49.     else // default
  50.     {
  51.         if ( bIsCrouched )
  52.             AnimateCrouchWalking();
  53.         else if ( bIsWalking )
  54.             AnimateWalking();
  55.         else
  56.             AnimateRunning();
  57.     }
  58. }
  59.  
  60. // Play appropriate idle animations
  61. simulated function PlayWaiting()
  62. {
  63.     if(bIsCrouched)
  64.     {
  65.         LoopAnim('boxidlecrouch');
  66.     }
  67.     else
  68.     {
  69.         LoopAnim('boxidle');
  70.     }
  71. }
  72.  
  73.  
  74. // Play appropriate crouching animations
  75. simulated function AnimateCrouchWalking()
  76. {
  77.     MovementAnims[0]='boxcrouch';
  78.     MovementAnims[1]='boxcrouch';
  79.     MovementAnims[2]='boxcrouch';
  80.     MovementAnims[3]='boxcrouch';
  81.     TurnLeftAnim='boxcrouch';
  82.     TurnRightAnim='boxcrouch';
  83. }
  84.  
  85.  
  86. // Play appropriate walking animations
  87. simulated function AnimateWalking()
  88. {
  89.     MovementAnims[0]='boxwalk';
  90.     MovementAnims[1]='boxwalk';
  91.     MovementAnims[2]='boxwalk';
  92.     MovementAnims[3]='boxwalk';
  93.     TurnLeftAnim='boxwalk';
  94.     TurnRightAnim='boxwalk';
  95. }
  96.  
  97. // Play appropriate running animations
  98. simulated function AnimateRunning()
  99. {
  100.     MovementAnims[0]='boxrun';
  101.     MovementAnims[1]='boxrun';
  102.     MovementAnims[2]='boxrun';
  103.     MovementAnims[3]='boxrun';
  104.     TurnLeftAnim='boxrun';
  105.     TurnRightAnim='boxrun';
  106. }
  107.  
  108. // Play appropriate flying animations
  109. simulated function AnimateFlying()
  110. {
  111.     MovementAnims[0]='boxfly';
  112.     MovementAnims[1]='boxfly';
  113.     MovementAnims[2]='boxfly';
  114.     MovementAnims[3]='boxfly';
  115.     TurnLeftAnim='boxrun';
  116.     TurnRightAnim='boxrun';
  117. }
  118.  
  119.  
  120. simulated event PostBeginPlay()
  121. {
  122.     Super.PostBeginPlay();
  123.  
  124.     // if this pawn is supposed to cast dynamic shadows
  125.     if(bActorShadows && bPlayerShadows)
  126.     {
  127.         // Spawn the shadow and intialize it
  128.         Shadow = Spawn(class'ShadowProjector',None,'',Location);
  129.         Shadow.ShadowActor = self;
  130.         Shadow.LightDirection = Normal(vect(1,1,3));
  131.         Shadow.LightDistance = 380;
  132.         Shadow.MaxTraceDistance = 3000;
  133.         Shadow.bBlobShadow = bBlobShadow;
  134.         Shadow.InitShadow();
  135.         Shadow.UpdateShadow();
  136.     }
  137. }
  138.  
  139.  
  140. event Bump(Actor other)
  141. {
  142.     local KActor kActor;
  143.  
  144.     super.Bump(other);
  145.     
  146.     if(KActor(other) != None)
  147.         kActor = KActor(other);
  148.     else
  149.         return;
  150.  
  151.     kActor.KAddImpulse(Normal(other.Location - Location) * 10000, location);
  152.  
  153.  
  154. }
  155.  
  156. defaultproperties
  157. {
  158.     Mesh=SkeletalMesh'RT_Box_K.BoxModel'
  159.     MovementAnims[0]="boxrun"
  160.     MovementAnims[1]="boxrun"
  161.     MovementAnims[2]="boxrun"
  162.     MovementAnims[3]="boxrun"
  163.     TurnLeftAnim="boxrun"
  164.     TurnRightAnim="boxrun"
  165.     bPhysicsAnimUpdate=true
  166.     bCanCrouch=true
  167.     Skins(0)=Texture'RT_BoxSkins_T.GreySkin'
  168.     bActorShadows=true
  169.     BaseEyeHeight=128
  170. }