using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.Animations;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class AnimationSpeed : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler
{
public float speed = 1;//动画播放速度
private float delay = 0.2f;//延迟时间
private bool isDown = false;// 按钮是否是按下状态
private float lastIsDownTime;// 按钮最后一次是被按住状态时候的时间
public Animator anim;//动画
void Start()
{
anim.speed = 1;
}
// Update is called once per frame
void Update()
{
// 如果按钮是被按下状态
if (isDown)
{
if (Time.time - lastIsDownTime > delay)
{
print("长按!
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.Animations;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class AnimationSpeed : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler
{
public float speed = 1;//动画播放速度
private float delay = 0.2f;//延迟时间
private bool isDown = false;// 按钮是否是按下状态
private float lastIsDownTime;// 按钮最后一次是被按住状态时候的时间
public Animator anim;//动画
void Start()
{
anim.speed = 1;
}
// Update is called once per frame
void Update()
{
// 如果按钮是被按下状态
if (isDown)
{
if (Time.time - lastIsDownTime > delay)
{
print("长按!