using UnityEngine;
using UnityEngine.EventSystems;
public class OnAnXiaBuSongShou : MonoBehaviour , IPointerUpHandler,IPointerDownHandler
{
public GameObject run_GameObject;
public float speed=10f;
private bool isRun;
public void Move()
{
run_GameObject.transform.position += run_GameObject.transform.forward * speed*Time.deltaTime;
}
// Update is called once per frame
void Update () {
if(isRun)
{
Move();
}
}
public void OnPointerUp(PointerEventData eventData)
{
isRun = false;
}
public void OnPointerDown(PointerEventData eventData)
{
isRun = true;
}
}