added animation for weapon(walking)

This commit is contained in:
2022-04-13 22:38:42 +07:00
parent 95f61ab7e2
commit 1d41490f11
6 changed files with 88 additions and 13 deletions

View File

@ -4,9 +4,12 @@ using static scr_Models;
public class scr_WeaponController : MonoBehaviour
{
private scr_CharacterController characterController;
[Header("Settings")]
[Header("Settings")]
public WeaponSettingsModel settings;
[Header("References")]
public Animator weaponAnimator;
private bool isInitialised;
Vector3 newWeaponRotation;
@ -38,6 +41,8 @@ public class scr_WeaponController : MonoBehaviour
{
return;
}
weaponAnimator.speed = characterController.weaponAnimationSpeed;
targetWeaponRotation.y += settings.SwayAmount * (settings.SwayXInverted ? -characterController.input_View.x : characterController.input_View.x) * Time.deltaTime;
targetWeaponRotation.x += settings.SwayAmount * (settings.SwayYInverted ? characterController.input_View.y : -characterController.input_View.y) * Time.deltaTime;