fgm24/Assets/Scripts/Player/PlayerAnimationHandler.cs

43 lines
912 B
C#
Raw Normal View History

2024-02-03 11:42:50 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerAnimationHandler : MonoBehaviour
{
Animator animator;
void Start()
{
animator = GetComponentInChildren<Animator>();
}
void Update()
{
2024-02-03 12:21:41 +01:00
if (Input.GetKeyDown(KeyCode.I))
Idle(true);
2024-02-03 11:42:50 +01:00
if (Input.GetKeyDown(KeyCode.Space))
2024-02-03 12:21:41 +01:00
Mop(true);
if (Input.GetKeyDown(KeyCode.R))
Run(true);
2024-02-03 11:42:50 +01:00
}
2024-02-03 12:21:41 +01:00
public void Idle(bool active)
2024-02-03 11:42:50 +01:00
{
2024-02-03 12:21:41 +01:00
animator.SetBool("Idle", active);
2024-02-03 11:42:50 +01:00
}
2024-02-03 12:21:41 +01:00
public void Run(bool active)
2024-02-03 11:42:50 +01:00
{
2024-02-03 12:21:41 +01:00
animator.SetBool("Run", active);
2024-02-03 11:42:50 +01:00
}
2024-02-03 12:21:41 +01:00
public void Swing(bool active)
2024-02-03 11:42:50 +01:00
{
2024-02-03 12:21:41 +01:00
animator.SetBool("Swing",active);
}
public void Mop(bool active)
{
animator.SetBool("Mop", active);
2024-02-03 11:42:50 +01:00
}
2024-02-03 12:21:41 +01:00
public void RunMop(bool active)
2024-02-03 11:42:50 +01:00
{
2024-02-03 12:21:41 +01:00
animator.SetBool("RunMop", active);
2024-02-03 11:42:50 +01:00
}
}