using UnityEngine;
using System.Collections;
public class but1 : MonoBehaviour {
public float horizontalSpeed = 80f;
public bool isPress = false;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (isPress)
{
Camera.main.transform.Translate(Vector3.up * horizontalSpeed * Time.deltaTime);
}
}
void OnPress(bool isPressed) //OnPress长按事件
{
if (isPressed)
{
isPress = true;
}
else
{
isPress = false;
}
}
}
using System.Collections;
public class but1 : MonoBehaviour {
public float horizontalSpeed = 80f;
public bool isPress = false;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (isPress)
{
Camera.main.transform.Translate(Vector3.up * horizontalSpeed * Time.deltaTime);
}
}
void OnPress(bool isPressed) //OnPress长按事件
{
if (isPressed)
{
isPress = true;
}
else
{
isPress = false;
}
}
}