Megacity demo game for UOS
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

39 行
1.3 KiB

using EasyUIAnimator;
using UnityEngine;
using UnityEngine.UI;
namespace Unity.MegaCity.Gameplay
{
public class HUDController : MonoBehaviour
{
public Image accelerateInactive;
public Image accelerateActive;
private bool _accelerateStatus;
private const float Duration = 0.3f;
// Update is called once per frame
void LateUpdate()
{
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
{
if (!_accelerateStatus)
{
// 按下加速,且之前非加速状态
UIAnimator.FadeOut(accelerateInactive, Duration).Play();
UIAnimator.FadeIn(accelerateActive, Duration).Play();
_accelerateStatus = true;
}
}
else
{
if (_accelerateStatus)
{
// 没按加速,且之前为加速状态
UIAnimator.FadeOut(accelerateActive, Duration).Play();
UIAnimator.FadeIn(accelerateInactive, Duration).Play();
_accelerateStatus = false;
}
}
}
}
}