Esempio n. 1
0
    public override void MakeSelected()
    {
        base.MakeSelected();
        GameGlobals.ChangeSelected(Enums.SelectionType.PROP);

        _ui.Reset();
        _ui._DestroyButton.onClick.AddListener(delegate { this.OnDestoyClick(); });
    }
Esempio n. 2
0
    public override void MakeSelected()
    {
        base.MakeSelected();
        GameGlobals.ChangeSelected(Enums.SelectionType.DIRECTIONAL_LIGHT);

        _ui.Reset();

        _ui._IntensitySlider.onValueChanged.AddListener(onLightIntensityChanged);
        _ui._ShadowIntensitySlider.onValueChanged.AddListener(onShadowIntensityChanged);
        _ui._ColorPicker.onValueChanged.AddListener(onColorChanged);
        _ui._AimSunButton.onClick.AddListener(onAimSunClick);
        _ui._DestroyButton.onClick.AddListener(delegate { this.OnDestoyClick(); });

        _ui._IntensitySlider.value       = _lightIntensity;
        _ui._ShadowIntensitySlider.value = _shadowIntensity;
        _ui._ColorPicker.CurrentColor    = _color;
    }
Esempio n. 3
0
    public override void MakeSelected()
    {
        base.MakeSelected();
        GameGlobals.ChangeSelected(Enums.SelectionType.POINT_LIGHT);
        //_ui = PropertiesUIController._Properties._PanelARPointLight;

        _ui.Reset();

        _ui._IntensitySlider.onValueChanged.AddListener(OnLightIntensityChanged);
        _ui._ShadowIntensitySlider.onValueChanged.AddListener(OnShadowIntensityChanged);
        _ui._ColorPicker.onValueChanged.AddListener(OnColorChanged);
        _ui._RangeSlider.onValueChanged.AddListener(OnRangeChanged);
        _ui._DestroyButton.onClick.AddListener(delegate { this.OnDestoyClick(); });

        _ui._IntensitySlider.value       = _lightIntensity;
        _ui._ShadowIntensitySlider.value = _shadowIntensity;
        _ui._RangeSlider.value           = _range;
        _ui._ColorPicker.CurrentColor    = _color;
    }
Esempio n. 4
0
 protected void OnDestoyClick()
 {
     GameGlobals.ChangeSelected(Enums.SelectionType.NONE);
     Destroy(gameObject);
 }
Esempio n. 5
0
    /// <summary>
    /// Update location marker state.
    /// </summary>
    private void _UpdateLocationMarker()
    {
        if (Input.touchCount == 2)
        {
            return;
        }

        if (Input.touchCount == 1 || Input.GetMouseButtonDown(1))
        {
            // Single tap -- place new location or select existing location.

            Vector2 pos = new Vector2();
            if (Input.touchCount == 1)
            {
                Touch t = Input.GetTouch(0);
                pos = t.position;
                if (t.phase != TouchPhase.Began ||
                    UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject(t.fingerId))
                {
                    return;
                }
            }
            else
            {
                if (UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject())
                {
                    return;
                }
                pos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
            }

            if (GameGlobals.PropertiesPanelOpen)
            {
                GameGlobals.SetPropertiesOpen(false);
                return;
            }

            Vector2    guiPosition = new Vector2(pos.x, Screen.height - pos.y);
            Camera     cam         = Camera.main;
            RaycastHit hitInfo;

            if (m_selectedRect.Contains(guiPosition) || m_hideAllRect.Contains(guiPosition))
            {
                // do nothing, the button will handle it
            }
            else if (Physics.Raycast(cam.ScreenPointToRay(pos), out hitInfo, 10, 1 << _PrefabObjLayer))
            {
                // Found a prefab, select it (so long as it isn't disappearing)!
                GameObject tapped = hitInfo.collider.transform.root.gameObject;
                //Debug.Log(tapped.name + " tapped!");
                m_selectedPrefab = tapped.GetComponent <ARSelectable>();
                m_selectedPrefab.MakeSelected();

                //if (!tapped.GetComponent<Animation>().isPlaying)
                //{
                //    m_selectedPrefab = tapped.GetComponent<PrefabObject>();
                //}
            }
            else
            {
                // Place a new point at that location, clear selection
                m_selectedPrefab = null;
                GameGlobals.ChangeSelected(Enums.SelectionType.NONE);

                StartCoroutine(_WaitForDepthAndFindPlane(pos));

                // Because we may wait a small amount of time, this is a good place to play a small
                // animation so the user knows that their input was received.
                RectTransform touchEffectRectTransform = (RectTransform)Instantiate(m_prefabTouchEffect);
                touchEffectRectTransform.transform.SetParent(m_canvas.transform, false);
                Vector2 normalizedPosition = pos;
                normalizedPosition.x /= Screen.width;
                normalizedPosition.y /= Screen.height;
                touchEffectRectTransform.anchorMin = touchEffectRectTransform.anchorMax = normalizedPosition;
            }
        }
    }
Esempio n. 6
0
 private void onSunClick()
 {
     GameGlobals.ChangeSelected(Enums.SelectionType.DIRECTIONAL_LIGHT);
     GameGlobals.SetPropertiesOpen(true);
     ARDirectionalLight._Sun.MakeSelected();
 }