2021-03-05 19:00:50 +01:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class PlayerAnimationController : MonoBehaviour
|
|
|
|
{
|
2021-03-23 12:48:43 +01:00
|
|
|
private const string IS_WALKING = "IsWalking";
|
|
|
|
private const string IN_JUMP_STATE = "InJumpState";
|
|
|
|
private const string IN_BOOST_STATE = "InBoostState";
|
|
|
|
public struct AnimationParams
|
|
|
|
{
|
|
|
|
public bool IsWalking;
|
|
|
|
public bool InJumpState;
|
|
|
|
public bool InBoostState;
|
|
|
|
}
|
|
|
|
|
2021-03-05 19:00:50 +01:00
|
|
|
[SerializeField] private Animator _animator;
|
|
|
|
[SerializeField] private CharacterController _controller;
|
|
|
|
|
2021-03-23 12:48:43 +01:00
|
|
|
private AnimationParams _params;
|
|
|
|
|
|
|
|
public void ProcessAnimUpdate( AnimationParams animParams )
|
2021-03-05 19:00:50 +01:00
|
|
|
{
|
2021-03-23 12:48:43 +01:00
|
|
|
_animator.SetBool(IS_WALKING, animParams.IsWalking);
|
|
|
|
_animator.SetBool(IN_JUMP_STATE, animParams.InJumpState);
|
|
|
|
_animator.SetBool(IN_BOOST_STATE, animParams.InBoostState);
|
2021-03-05 19:00:50 +01:00
|
|
|
}
|
|
|
|
}
|