60 lines
1.2 KiB
C#
Raw Permalink Normal View History

2025-05-18 01:04:31 +08:00
// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2020-12-23
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
// <copyright file= "Footstep" company="Kunpo"></copyright>
// <summary></summary>
// ***********************************************************************
using UnityEngine;
namespace G
{
/// <summary>
///
/// </summary>
public class Footstep : MonoBehaviour
{
private EntityMainPlayer _scriptCha;
private bool _turnOn;
private float _delay;
private ParticleSystem _particle;
private void Start()
{
_scriptCha = EntityMainPlayer.Instance;
_particle = GetComponentInChildren<ParticleSystem>();
_particle.Stop();
}
private void Update()
{
if (_delay > 0.5f)
{
var moveState = _scriptCha.moveState;
if (moveState == MoveState.state2_Run)
{
if (!_turnOn)
{
_turnOn = true;
_particle.Play();
}
}
else
{
_turnOn = false;
_particle.Stop();
}
}
else
{
_delay += Time.deltaTime;
}
}
}
}