From 71db52c5443a7bf82d9a23a770994a42b043be04 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Thu, 27 Jul 2023 22:11:31 +0100 Subject: Initial commit --- code/pawn/PlayerAnimator.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 code/pawn/PlayerAnimator.cs (limited to 'code/pawn/PlayerAnimator.cs') diff --git a/code/pawn/PlayerAnimator.cs b/code/pawn/PlayerAnimator.cs new file mode 100644 index 0000000..4cd4e3f --- /dev/null +++ b/code/pawn/PlayerAnimator.cs @@ -0,0 +1,21 @@ +using Sandbox; +using System; + +namespace MurderGame; + +public class PlayerAnimator : EntityComponent, ISingletonComponent +{ + public void Simulate() + { + var helper = new CitizenAnimationHelper( Entity ); + helper.WithVelocity( Entity.Velocity ); + helper.WithLookAt( Entity.EyePosition + Entity.EyeRotation.Forward * 100 ); + helper.HoldType = CitizenAnimationHelper.HoldTypes.None; + helper.IsGrounded = Entity.GroundEntity.IsValid(); + + if ( Entity.Controller.HasEvent( "jump" ) ) + { + helper.TriggerJump(); + } + } +} -- cgit v1.2.3-70-g09d2