private void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                var pos = _camera.ScreenPointToRay(Input.mousePosition).origin;
                _selectedIdx = FindOverlappedParticle(pos);
            }

            if (_selectedIdx >= 0)
            {
                var m   = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical")) * Time.deltaTime * _moveFactor;
                var pos = _target.GetParticlePosition(_selectedIdx);
                pos += m;
                _target.SetParticlePosition(_selectedIdx, pos);
            }
        }
Exemple #2
0
        private void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                var pos = _camera.ScreenPointToRay(Input.mousePosition).origin;
                _overlappedIdx = FindOverlappedParticle(pos);
            }
            else if (Input.GetMouseButtonUp(0))
            {
                _overlappedIdx = -1;
            }

            if (_overlappedIdx >= 0)
            {
                var pos = _camera.ScreenPointToRay(Input.mousePosition).origin;
                _target.SetParticlePosition(_overlappedIdx, pos);
            }
        }