ssss
This commit is contained in:
parent
6f0f0f3023
commit
cb9cf36c58
@ -4,7 +4,7 @@ using System;
|
|||||||
/// Used to control the Citizen animation state. You don't have to use this to animate your citizen avatar, but our
|
/// Used to control the Citizen animation state. You don't have to use this to animate your citizen avatar, but our
|
||||||
/// aim is to put everything you need in this class, so you can easily see what variables are available.
|
/// aim is to put everything you need in this class, so you can easily see what variables are available.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Title( "Animation Helper" )]
|
[Title( "[KPTL] Animation Helper" )]
|
||||||
[Category( "KPTL" )]
|
[Category( "KPTL" )]
|
||||||
[Icon( "directions_run" )]
|
[Icon( "directions_run" )]
|
||||||
public sealed class AnimationHelper : Component, Component.ExecuteInEditor
|
public sealed class AnimationHelper : Component, Component.ExecuteInEditor
|
||||||
|
@ -4,7 +4,7 @@ using Sandbox.Utility;
|
|||||||
|
|
||||||
namespace Sandbox;
|
namespace Sandbox;
|
||||||
|
|
||||||
[Title( "Connect" )]
|
[Title( "[KPTL] Connect" )]
|
||||||
[Category( "KPTL" )]
|
[Category( "KPTL" )]
|
||||||
[Icon( "electrical_services" )]
|
[Icon( "electrical_services" )]
|
||||||
public sealed class KPTLConnect : Component, Component.INetworkListener
|
public sealed class KPTLConnect : Component, Component.INetworkListener
|
||||||
|
12
Code/Kal.cs
12
Code/Kal.cs
@ -20,8 +20,6 @@ public sealed class Kal : Component
|
|||||||
[Property] [Range(200f, 500f, 20f)] public float JumpStrength { get; set; } = 350f;
|
[Property] [Range(200f, 500f, 20f)] public float JumpStrength { get; set; } = 350f;
|
||||||
|
|
||||||
[Sync] public Angles EyeAngles { get; set; }
|
[Sync] public Angles EyeAngles { get; set; }
|
||||||
// [Sync] public bool IsDucking { get; set; }
|
|
||||||
// [Sync] public bool IsRunning { get; set; }
|
|
||||||
|
|
||||||
protected override void OnStart()
|
protected override void OnStart()
|
||||||
{
|
{
|
||||||
@ -47,10 +45,10 @@ public sealed class Kal : Component
|
|||||||
if ( Network.IsOwner )
|
if ( Network.IsOwner )
|
||||||
{
|
{
|
||||||
var wishDirection = Input.AnalogMove.Normal * Rotation.FromYaw( EyeAngles.yaw );
|
var wishDirection = Input.AnalogMove.Normal * Rotation.FromYaw( EyeAngles.yaw );
|
||||||
var IsDucking = Input.Down( "Duck" );
|
var isDucking = Input.Down( "Duck" );
|
||||||
var IsRunning = Input.Down( "Run" );
|
var isRunning = Input.Down( "Run" );
|
||||||
var wishSpeed = IsDucking ? DuckSpeed :
|
var wishSpeed = isDucking ? DuckSpeed :
|
||||||
IsRunning ? RunSpeed : WalkSpeed;
|
isRunning ? RunSpeed : WalkSpeed;
|
||||||
|
|
||||||
Controller.WishVelocity = wishDirection * wishSpeed;
|
Controller.WishVelocity = wishDirection * wishSpeed;
|
||||||
|
|
||||||
@ -64,7 +62,7 @@ public sealed class Kal : Component
|
|||||||
|
|
||||||
if ( !AnimationHelper.IsValid() ) return;
|
if ( !AnimationHelper.IsValid() ) return;
|
||||||
|
|
||||||
AnimationHelper.DuckLevel = IsDucking ? 1f : 0f;
|
AnimationHelper.DuckLevel = isDucking ? 1f : 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationHelper.WithWishVelocity(Controller.WishVelocity);
|
AnimationHelper.WithWishVelocity(Controller.WishVelocity);
|
||||||
|
@ -11,25 +11,17 @@ public sealed class RagdollController : Component
|
|||||||
// Sensible Indexes
|
// Sensible Indexes
|
||||||
// 3 - HEad
|
// 3 - HEad
|
||||||
|
|
||||||
public void Toggle()
|
[Sync]
|
||||||
|
private bool Enabled
|
||||||
{
|
{
|
||||||
bool enable = !bodyPhysics.Enabled;
|
get => bodyPhysics.Enabled;
|
||||||
bodyPhysics.Enabled = enable;
|
set
|
||||||
bodyPhysics.MotionEnabled = enable;
|
{
|
||||||
bodyRenderer.UseAnimGraph = !enable;
|
Log.Info(value);
|
||||||
}
|
bodyPhysics.Enabled = value;
|
||||||
|
bodyPhysics.MotionEnabled = value;
|
||||||
public void EnableRagdoll()
|
bodyRenderer.UseAnimGraph = !value;
|
||||||
{
|
}
|
||||||
bool enable = true;
|
|
||||||
bodyPhysics.Enabled = enable;
|
|
||||||
bodyPhysics.MotionEnabled = enable;
|
|
||||||
bodyRenderer.UseAnimGraph = !enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DisableRagdoll()
|
|
||||||
{
|
|
||||||
bool enable = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateBody()
|
void UpdateBody()
|
||||||
@ -114,9 +106,10 @@ public sealed class RagdollController : Component
|
|||||||
{
|
{
|
||||||
if ( Network.IsOwner )
|
if ( Network.IsOwner )
|
||||||
{
|
{
|
||||||
if(Input.Pressed( "Ragdoll" ))
|
if (Input.Pressed( "Ragdoll" ))
|
||||||
{
|
{
|
||||||
Toggle();
|
Log.Info(123123);
|
||||||
|
Enabled = !Enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user