fgm24/Assets/Scripts/Player/PlayerAnimationHandler.cs

43 lines
912 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerAnimationHandler : MonoBehaviour
{
Animator animator;
void Start()
{
animator = GetComponentInChildren<Animator>();
}
void Update()
{
if (Input.GetKeyDown(KeyCode.I))
Idle(true);
if (Input.GetKeyDown(KeyCode.Space))
Mop(true);
if (Input.GetKeyDown(KeyCode.R))
Run(true);
}
public void Idle(bool active)
{
animator.SetBool("Idle", active);
}
public void Run(bool active)
{
animator.SetBool("Run", active);
}
public void Swing(bool active)
{
animator.SetBool("Swing",active);
}
public void Mop(bool active)
{
animator.SetBool("Mop", active);
}
public void RunMop(bool active)
{
animator.SetBool("RunMop", active);
}
}