Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Unicon 2.46 KB | None | 0 0
  1. /**
  2.  *  TWPlayerController
  3.  *
  4.  *  Creation date: 09/02/2011 19:34
  5.  *  Copyright 2011, Hugo
  6.  */
  7. class TWPlayerController extends PlayerController
  8.     config(Game);
  9.  
  10. var TWCharacter Character;
  11. var float JumpDelay;
  12.  
  13. simulated event PostBeginPlay()
  14. {
  15.     super.PostBeginPlay();
  16.    
  17.     Character = Spawn(class'TW.TWCharacter', self,'', Location, Rotation);
  18.     Character.SetOwner(self);
  19.    
  20.     EnterStartState();
  21.     `log("JOIN !!!!!!!!");
  22. }
  23.  
  24.  
  25. exec function StartFire( optional byte FireModeNum )
  26. {
  27.     local vector loc, norm, end;
  28.     local TraceHitInfo hitInfo;
  29.     local Actor traceHit;
  30.  
  31.     end = Location + normal(vector(Rotation))*200; // Distance des bras !
  32.     traceHit = trace(loc, norm, end, Location, true,, hitInfo);
  33.  
  34.     if (KActor(traceHit) != none && Character != none)
  35.     {
  36.         ClientMessage("Push!");
  37.         KActor(traceHit).ApplyImpulse( -norm, 1000, loc);
  38.     }
  39. }
  40.  
  41. exec function StartAltFire( optional byte FireModeNum )
  42. {
  43.     local vector loc, norm, end;
  44.     local TraceHitInfo hitInfo;
  45.     local Actor traceHit;
  46.  
  47.     end = Location + normal(vector(Rotation))*200; // Distance des bras !
  48.     traceHit = trace(loc, norm, end, Location, true,, hitInfo);
  49.  
  50.     if (traceHit != none && Character != none)
  51.     {
  52.         ClientMessage("Attache!");
  53.         Character.Attach(traceHit);
  54.     }
  55. }
  56.  
  57. exec function StopAltFire( optional byte FireModeNum )
  58. {
  59.     Character.UnAttach();
  60. }
  61.  
  62.  
  63. function EnterStartState()
  64. {
  65.     GotoState('CharacterMove');
  66. }
  67.  
  68. state CharacterMove
  69. {
  70.     ignores SeePlayer, HearNoise, Bump;
  71.  
  72.     function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot);
  73.  
  74.     function PlayerMove( float DeltaTime )
  75.     {      
  76.         local vector Impulse;
  77.         local vector X,Y,Z;
  78.        
  79.         UpdateRotation(DeltaTime);
  80.        
  81.         GetAxes(Rotation,X,Y,Z);
  82.        
  83.         Impulse = PlayerInput.aForward*X + PlayerInput.aStrafe*Y;
  84.        
  85.         //Impulse.Y = -PlayerInput.aForward;
  86.         //Impulse.X = PlayerInput.aStrafe;
  87.  
  88.         JumpDelay+=DeltaTime;
  89.        
  90.         if (Character != None)
  91.         {
  92.             if (Role == ROLE_Authority || Role < ROLE_Authority)
  93.             {
  94.                 if (PlayerInput.aUp != 0 && JumpDelay >= 0.5) // Peu sauter toute les 0.5 secondes
  95.                     Character.DoJump();
  96.                 Character.ApplyImpulse( Impulse, 100, Character.Location);
  97.                 SetLocation(Character.Location);
  98.                 Character.SetRotation(Rotation);
  99.             }
  100.         }
  101.        
  102.  
  103.     }
  104. }
  105.  
  106. auto state PlayerWaiting
  107. {
  108.     exec function PressStart()
  109.     {
  110.  
  111.     }
  112.     Begin:
  113.         Sleep(0.5f);
  114.         GotoState('CharacterMove');
  115. }
  116.  
  117.  
  118. defaultproperties
  119. {
  120.     RemoteRole = ROLE_AutonomousProxy
  121.     JumpDelay = 0.0
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement