コード例 #1
0
            public override void OnDragAnchor()
            {
                Ray ray = _connectionCreator._camera.ScreenPointToRay(Input.mousePosition);

                RaycastHit hit;

                if (Physics.Raycast(ray, out hit))
                {
                    ConnectionAnchor overedAnchor = hit.collider.GetComponent <ConnectionAnchor>();
                    if (overedAnchor != null && _connectionCreator._overedAnchor != overedAnchor && overedAnchor != _connectionCreator._activeAnchor)
                    {
                        overedAnchor.SetActive();
                        _connectionCreator._overedAnchor?.SetPossible();
                        _connectionCreator._overedAnchor = overedAnchor;
                    }
                    else if (overedAnchor == null && _connectionCreator._overedAnchor != null)
                    {
                        _connectionCreator._overedAnchor.SetPossible();
                        _connectionCreator._overedAnchor = null;
                    }
                }

                float enter;

                if (_connectionCreator._plane.Raycast(ray, out enter))
                {
                    Vector3 hitPoint = ray.GetPoint(enter);
                    _connectionCreator._mouseTransform.position = hitPoint;
                }
            }
コード例 #2
0
 public override void OnClickAnchor(ConnectionAnchor connectionAnchor)
 {
     /*_connectionCreator.ActivateAnchor(connectionAnchor);
      *
      * Destroy(_connectionCreator._tempConnection.gameObject);
      *
      * _connectionCreator._state = new AnchorClickedState(_connectionCreator);*/
 }
コード例 #3
0
            public override void OnBeginDragAnchor(ConnectionAnchor connectionAnchor)
            {
                _connectionCreator.ActivateAnchor(connectionAnchor);

                _connectionCreator._mouseTransform.position = _connectionCreator._activeAnchor.transform.position;
                _connectionCreator._tempConnection          = _connectionCreator.CreateConnection(_connectionCreator._mouseTransform, _connectionCreator._activeAnchor.transform);

                _connectionCreator._state = new AnchorDragedState(_connectionCreator);
            }
コード例 #4
0
 protected void ActivateAnchor(ConnectionAnchor connectionAnchor)
 {
     foreach (ConnectionAnchor anchor in _connectionAnchors)
     {
         anchor.SetPossible();
     }
     connectionAnchor.SetActive();
     _activeAnchor = connectionAnchor;
 }
コード例 #5
0
            public override void OnClickAnchor(ConnectionAnchor connectionAnchor)
            {
                if (_connectionCreator._activeAnchor != connectionAnchor)
                {
                    _connectionCreator.CreateConnection(_connectionCreator._activeAnchor.transform, connectionAnchor.transform);
                }
                _connectionCreator.DisactivateAnchors();

                _connectionCreator._state = new DisactiveState(_connectionCreator);
            }
コード例 #6
0
        public void OnBeginDrag(CustomInputInfo info)
        {
            ConnectionAnchor connectionAnchor = info.CollidedGameObject.GetComponent <ConnectionAnchor>();

            if (connectionAnchor != null)
            {
                _state.OnBeginDragAnchor(connectionAnchor);
            }
            else
            {
                _state.OnEmptyClick();
            }
        }
コード例 #7
0
 public override void OnBeginDragAnchor(ConnectionAnchor connectionAnchor)
 {
 }
コード例 #8
0
            public override void OnClickAnchor(ConnectionAnchor connectionAnchor)
            {
                _connectionCreator.ActivateAnchor(connectionAnchor);

                _connectionCreator._state = new AnchorClickedState(_connectionCreator);
            }
コード例 #9
0
 abstract public void OnBeginDragAnchor(ConnectionAnchor connectionAnchor);
コード例 #10
0
 abstract public void OnClickAnchor(ConnectionAnchor connectionAnchor);