UUUUUUUUUUUUUUUUH
This commit is contained in:
1 parent
e8393a28ad
commit
f0bb83c869
110 files changed
+55065
-21232
No files matched your search
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using KinematicCharacterController;
|
||||
using Reflex.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.OfficeGame.Player
|
||||
{
|
||||
public class PlayerAnimator : MonoBehaviour
|
||||
{
|
||||
private static readonly int VelocityForward = Animator.StringToHash("VelocityForward");
|
||||
private static readonly int VelocityRight = Animator.StringToHash("VelocityRight");
|
||||
|
||||
private KinematicCharacterMotor _motor;
|
||||
private Animator _animator;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_motor = GetComponent<KinematicCharacterMotor>();
|
||||
_animator = GetComponentInChildren<Animator>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var forwardVelocity =
|
||||
Vector3.Project(_motor.Velocity, transform.right).magnitude;
|
||||
_animator.SetFloat(VelocityForward, forwardVelocity);
|
||||
|
||||
var rightVelocity =
|
||||
Vector3.Project(_motor.Velocity, transform.forward).magnitude;
|
||||
_animator.SetFloat(VelocityRight, rightVelocity);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05290340b907438c8fcb9d5f0e75624f
|
||||
timeCreated: 1791910777
|
||||
@@ -55,8 +55,6 @@ namespace Code.Game.Gameplay.Player
|
||||
[TabGroup("Jumping")] public Vector3 Gravity = new Vector3(0, -30f, 0);
|
||||
|
||||
[TabGroup("Misc")] public List<Collider> IgnoredColliders = new List<Collider>();
|
||||
public Vector3 CurrentVelocity => Motor.Velocity;
|
||||
public Quaternion CurrentRotation => Motor.TransientRotation;
|
||||
|
||||
private Vector3 _moveInputVector;
|
||||
private Vector3 _lookInputVector;
|
||||
|
||||
Reference in new issue
Block a user