Ejemplo n.º 1
0
    public void TryToPlaceObject()
    {
        Ray ray = _myCam.ScreenPointToRay(Input.mousePosition);

        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 1000f))
        {
            var posiblePlace = hit.collider.GetComponent <PickableReceiver>();

            if (posiblePlace != null)
            {
                _currentPickableReceiver = posiblePlace;
                ParabolicShooter.DrawPath(_currentPickable.GetPosition(), _currentPickableReceiver.PlaceToPutObject.position);
                posiblePlace.OnDragObjectHover();
            }
            else
            {
                if (_currentPickableReceiver != null)
                {
                    _currentPickableReceiver.OnExitDragObjectHover();
                }

                _currentPickableReceiver = null;
            }
        }
    }