Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * TWPlayerController
- *
- * Creation date: 09/02/2011 19:34
- * Copyright 2011, Hugo
- */
- class TWPlayerController extends PlayerController
- config(Game);
- var TWCharacter Character;
- var float JumpDelay;
- simulated event PostBeginPlay()
- {
- super.PostBeginPlay();
- Character = Spawn(class'TW.TWCharacter', self,'', Location, Rotation);
- Character.SetOwner(self);
- EnterStartState();
- `log("JOIN !!!!!!!!");
- }
- exec function StartFire( optional byte FireModeNum )
- {
- local vector loc, norm, end;
- local TraceHitInfo hitInfo;
- local Actor traceHit;
- end = Location + normal(vector(Rotation))*200; // Distance des bras !
- traceHit = trace(loc, norm, end, Location, true,, hitInfo);
- if (KActor(traceHit) != none && Character != none)
- {
- ClientMessage("Push!");
- KActor(traceHit).ApplyImpulse( -norm, 1000, loc);
- }
- }
- exec function StartAltFire( optional byte FireModeNum )
- {
- local vector loc, norm, end;
- local TraceHitInfo hitInfo;
- local Actor traceHit;
- end = Location + normal(vector(Rotation))*200; // Distance des bras !
- traceHit = trace(loc, norm, end, Location, true,, hitInfo);
- if (traceHit != none && Character != none)
- {
- ClientMessage("Attache!");
- Character.Attach(traceHit);
- }
- }
- exec function StopAltFire( optional byte FireModeNum )
- {
- Character.UnAttach();
- }
- function EnterStartState()
- {
- GotoState('CharacterMove');
- }
- state CharacterMove
- {
- ignores SeePlayer, HearNoise, Bump;
- function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot);
- function PlayerMove( float DeltaTime )
- {
- local vector Impulse;
- local vector X,Y,Z;
- UpdateRotation(DeltaTime);
- GetAxes(Rotation,X,Y,Z);
- Impulse = PlayerInput.aForward*X + PlayerInput.aStrafe*Y;
- //Impulse.Y = -PlayerInput.aForward;
- //Impulse.X = PlayerInput.aStrafe;
- JumpDelay+=DeltaTime;
- if (Character != None)
- {
- if (Role == ROLE_Authority || Role < ROLE_Authority)
- {
- if (PlayerInput.aUp != 0 && JumpDelay >= 0.5) // Peu sauter toute les 0.5 secondes
- Character.DoJump();
- Character.ApplyImpulse( Impulse, 100, Character.Location);
- SetLocation(Character.Location);
- Character.SetRotation(Rotation);
- }
- }
- }
- }
- auto state PlayerWaiting
- {
- exec function PressStart()
- {
- }
- Begin:
- Sleep(0.5f);
- GotoState('CharacterMove');
- }
- defaultproperties
- {
- RemoteRole = ROLE_AutonomousProxy
- JumpDelay = 0.0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement