void OnSceneGUI()
 {
     if (Event.current.type == EventType.MouseDown)
     {
         MapController targetMap     = (MapController)target;
         Vector3       mousePosition = Event.current.mousePosition;
         Ray           ray           = HandleUtility.GUIPointToWorldRay(mousePosition);
         RaycastHit    hit           = new RaycastHit();
         if (Physics.Raycast(ray, out hit))
         {
             targetMap.ChangeTile(hit.transform.root.gameObject);
         }
     }
 }
Beispiel #2
0
    private void FixedUpdate()
    {
        transform.position = transform.position + new Vector3(speed, 0, 0);

        if (transform.position.x > mapController.MapWidth)
        {
            Destroy(gameObject);
        }

        Ray ray = new Ray(transform.position + new Vector3(0, 5, 0), Vector3.down);

        if (Physics.Raycast(ray, out RaycastHit hit, 20))
        {
            mapController.curstate = MapController.editstate.oceans;
            mapController.ChangeTile(hit.transform.gameObject);
        }
        //mapController.tiles[(int)transform.position.x, (int)transform.position.z].(Resources)myTile.; < ------ Replace with function which adds resources to tiles below cloud.
    }