StationObscurum/Assets/Scripts/Experimental/TestAnimationParameters.cs

45 lines
1.0 KiB
C#
Raw Normal View History

2023-04-11 05:58:47 +02:00
using UnityEngine;
public class TestAnimationParameters : MonoBehaviour
{
2023-06-01 17:03:48 +02:00
[SerializeField] private float speed;
[SerializeField] private int attackIndex;
[SerializeField] private int attack;
[SerializeField] private bool inlight;
[SerializeField] private int attackScream;
2023-04-11 05:58:47 +02:00
private Animator animator;
private int pattack = -1;
private int pAttackScream = -1;
2023-06-01 17:03:48 +02:00
2023-04-11 05:58:47 +02:00
// Start is called before the first frame update
2023-06-01 17:03:48 +02:00
private void Start()
2023-04-11 05:58:47 +02:00
{
2023-06-01 17:03:48 +02:00
animator = GetComponent<Animator>();
2023-04-11 05:58:47 +02:00
}
// Update is called once per frame
2023-06-01 17:03:48 +02:00
private void Update()
2023-04-11 05:58:47 +02:00
{
animator.SetFloat("Speed", speed);
animator.SetInteger("AttackIndex", attackIndex);
2023-06-01 17:03:48 +02:00
if (Input.GetKeyDown(KeyCode.Tab))
{
2023-04-11 05:58:47 +02:00
animator.SetTrigger("Attack");
pattack = attack;
2023-06-01 17:03:48 +02:00
}
;
2023-04-11 05:58:47 +02:00
animator.SetBool("InLight", inlight);
if (Input.GetKeyDown(KeyCode.Space))
{
animator.SetTrigger("AttackScream");
pAttackScream = attackScream;
}
}
2023-06-01 17:03:48 +02:00
}