123456789101112131415161718192021222324 |
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.EventSystems;
-
- public class Playermove : MonoBehaviour
- {
- public float speed = 300f; // 移动速度
- [SerializeField] GameObject Player;
- bool moveLeft;
- private void Update() {
- if (moveLeft){
- Player.GetComponent<RectTransform>().rotation =Quaternion.Euler(0, 180, 0);
- Player.GetComponent<Transform>().Translate(speed*Time.deltaTime,0,0);
- }
- }
- public void MOuseDown(){
- moveLeft = true;
- }
-
- // 当按钮松开时调用
- public void MOuseUP(){
- moveLeft = false;
- }
- }
|