Пример #1
0
    void Update()
    {
        fpsCDB.CalledUpdate();
#if UNITY_ANDROID
        if (Input.touchCount > 0)
        {
            if (Input.GetTouch(0).phase == TouchPhase.Began && pinScript.buttonSelected)
            {
                if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
                {
                    return;
                }
                var loc = ThrowTerrainTester();
                if (loc == new Vector3(0, 0, 0))
                {
                    return;
                }
                locationPin.SetActive(true);
                Instantiate(locationPin, loc, Quaternion.identity);
                locationPin.SetActive(false);
                pinScript.DisableButton();
            }

            if (Input.GetTouch(0).phase == TouchPhase.Began && lineScript.buttonSelected)
            {
                if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
                {
                    return;
                }
                if (Input.touchCount == 1)
                {
                    var loc = ThrowTerrainTester();
                    dot.SetActive(true);
                    dots.Add(Instantiate(dot, loc, Quaternion.identity));
                    dot.SetActive(false);
                    loc.y = loc.y + 10f;
                    linePoints.Add(loc);
                }
            }
            if (Input.GetTouch(0).phase == TouchPhase.Began && polyScript.buttonSelected)
            {
                if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
                {
                    return;
                }
                if (Input.touchCount == 1)
                {
                    var loc = ThrowTerrainTester();
                    dot.SetActive(true);
                    dots.Add(Instantiate(dot, loc, Quaternion.identity));
                    dot.SetActive(false);
                    polyPoints.Add(loc);
                }
            }
        }
#else
        if (Input.GetKeyDown(KeyCode.Mouse0) && pinScript.buttonSelected && !EventSystem.current.IsPointerOverGameObject())
        {
            var loc = ThrowTerrainTester();
            locationPin.GetComponent <LocationPin>().ClearFields();
            locationPin.SetActive(true);
            Instantiate(locationPin, loc, Quaternion.identity);
            Debug.Log("LocationPin Title:" + locationPin.GetComponent <LocationPin>().title.GetComponent <TMP_InputField>().text);
            locationPin.SetActive(false);
            pinScript.DisableButton();
        }

        if (Input.GetKeyDown(KeyCode.Mouse0) && lineScript.buttonSelected && !EventSystem.current.IsPointerOverGameObject())
        {
            var loc = ThrowTerrainTester();
            dot.SetActive(true);
            dots.Add(Instantiate(dot, loc, Quaternion.identity));
            dot.SetActive(false);
            loc.y = loc.y + 1f;
            linePoints.Add(loc);
        }

        if (Input.GetKeyDown(KeyCode.Mouse0) && polyScript.buttonSelected && !EventSystem.current.IsPointerOverGameObject())
        {
            var loc = ThrowTerrainTester();
            dot.SetActive(true);
            dots.Add(Instantiate(dot, loc, Quaternion.identity));
            dot.SetActive(false);
            loc.y = loc.y + 10f;
            polyPoints.Add(loc);
        }
#endif

        if (pinScript.buttonSelected || lineScript.buttonSelected || polyScript.buttonSelected)
        {
            toggle.enabled = false;
        }
        else
        {
            toggle.enabled = true;
        }
    }
Пример #2
0
 void Update()
 {
     script.CalledUpdate();
 }