// Update is called once per frame
    void Update()
    {
        if (_IsArrowAppearing)
        {
            arrowInst.SetActive(true);
            arrowInst.transform.Rotate(0, _RotationSpeed, 0);
        }
        else
        {
            arrowInst.SetActive(false);
        }

        ObjectInteractionManager.SetObjectPos(_id, gameObject.transform.position);

        float dis = ObjectInteractionManager.findNearestPointerDistance(_id);

        if (dis < _SelectDistance)
        {
            //print ("select!!");
            if (_IsArrowAppearing)
            {
                arrowInst.GetComponent <Renderer> ().material.color = _selectColor;
            }
            if (_SelectEvent != null)
            {
                if (_ActionExecuteType == ActionExecType.DuringSelecting)
                {
                    _SelectEvent.ClickAction();
                }
                else if (_ActionExecuteType == ActionExecType.Once)
                {
                    if (!isSelected)
                    {
                        isSelected = true;
                        _SelectEvent.ClickAction();
                    }
                }
            }
        }
        else if (dis < (_SelectDistance * 1.5f))
        {
            //print ("focus~~~");
            if (_IsArrowAppearing)
            {
                arrowInst.GetComponent <Renderer> ().material.color = _FocusColor;
            }
        }
        else
        {
            isSelected = false;
            if (_IsArrowAppearing)
            {
                arrowInst.GetComponent <Renderer> ().material.color = _NormalColor;
            }
        }
    }
Exemple #2
0
 public void SelectAction()
 {
     if (_isCancelItem)           // action for cancel item
     {
         ShortcutItemLayer prevLayer = _curLayer.PrevLayer;
         prevLayer.UILayer.AppearLayer(prevLayer.Level - _curLayer.Level);
         _curLayer.UILayer.DisappearLayer(prevLayer.Level - _curLayer.Level);
     }
     else
     {
         if (_action != null)
         {
             _action.ClickAction();
         }
         else
         {
             Debug.Log("action script is empty");
         }
     }
 }