暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Playermove.cs 612B

123456789101112131415161718192021222324
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.EventSystems;
  4. public class Playermove : MonoBehaviour
  5. {
  6. public float speed = 300f; // 移动速度
  7. [SerializeField] GameObject Player;
  8. bool moveLeft;
  9. private void Update() {
  10. if (moveLeft){
  11. Player.GetComponent<RectTransform>().rotation =Quaternion.Euler(0, 180, 0);
  12. Player.GetComponent<Transform>().Translate(speed*Time.deltaTime,0,0);
  13. }
  14. }
  15. public void MOuseDown(){
  16. moveLeft = true;
  17. }
  18. // 当按钮松开时调用
  19. public void MOuseUP(){
  20. moveLeft = false;
  21. }
  22. }