説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

PlayermoveR.cs 616B

12345678910111213141516171819202122232425
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.EventSystems;
  4. public class PlayermoveR : 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, 0, 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. }