28 lines
652 B
C#
28 lines
652 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
|
|
[System.Serializable]
|
|
public class AnimationInput
|
|
{
|
|
public string animationPropertyName;
|
|
public InputActionProperty action;
|
|
}
|
|
|
|
public class AnimateOnInput : MonoBehaviour
|
|
{
|
|
public List<AnimationInput> animationInputs;
|
|
public Animator animator;
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
foreach (var item in animationInputs)
|
|
{
|
|
float actionValue = item.action.action.ReadValue<float>();
|
|
animator.SetFloat(item.animationPropertyName, actionValue);
|
|
}
|
|
}
|
|
}
|