Beispiel #1
0
 // Start is called before the first frame update
 void Start()
 {
     Script = Player.GetComponent <TapToMove>();
 }
Beispiel #2
0
 // Start is called before the first frame update
 void Start()
 {
     Player       = GameObject.Find("Planet");
     Player_Color = Player.GetComponent <SpriteRenderer>();
     Script       = Player.GetComponent <TapToMove>();
 }
Beispiel #3
0
 void move()
 {
     Ray ray2 = cam.ScreenPointToRay(Input.mousePosition);
     if (!EventSystem.current.IsPointerOverGameObject()) {
         if (selectedScript != null) {
             if (selectedScript.isSelected == true && t != Time.frameCount) {
                 if (Input.GetMouseButtonDown(0)) {
                     Ray ray1 = cam.ScreenPointToRay(Input.mousePosition);
                     if (Physics.Raycast(ray1.origin, ray1.direction, out hit, 300, layer2.value)) {
                         hitpoint = hit.point;
                         Debug.Log("Moving!");
                         moveScript = selected.GetComponent<TapToMove>();
                         moveScript.ready_to_move = true;
                         selectedScript.hasMoved = true;
                     }
                     else {
                         Debug.Log("Too Far!");
                     }
                 }
             }
         }
     }
 }