コード例 #1
0
    private void DropMoveableObject()
    {
        if (CurrentlySelectableObject == null)
        {
            return;
        }

        if (!IsOverUIElement() && !CurrentlySelectableObject.IsCollision)
        {
            Debug.Log("SuccessfulPlacement");
            CurrentlySelectableObject.SuccessfulPlacement();
        }
        else if (CurrentlySelectableObject.IsFirstPlacement)
        {
            Debug.LogError("ReturnObjectToPool");
            ObjectPoolManager.Instance.ReturnObjectToPool(CurrentlySelectableObject.gameObject);
        }
        else
        {
            Debug.LogWarning("ReplaceObject");
            CurrentlySelectableObject.ReplaceObject();
        }

        // Reset values after we do not have control over an object
        IsValidPlacement = SelectableRadius.ShowDoWeHaveValidPositionInColor(true);

        // SelectableRadius.Show();
        MoveableObjectGrabbed = false;
    }
コード例 #2
0
 public void SetSelectableRadiusColor()
 {
     if (CurrentlySelectableObject != null)
     {
         IsValidPlacement = SelectableRadius.ShowDoWeHaveValidPositionInColor(IsOverUIElement() || CurrentlySelectableObject.IsCollision ? false : true);
     }
 }
コード例 #3
0
    private void FindAndGrabMoveableObject()
    {
        if (Physics.Raycast(mouseRay, out mouseHit, Mathf.Infinity, whatIsMoveableObject))
        {
            var newSelectableObject = mouseHit.transform.GetComponent <SelectableObject>();

            if (newSelectableObject != null)
            {
                CurrentlySelectableObject = newSelectableObject;
                CurrentlySelectableObject.BeingSelected();
                SelectableRadius.ShowViewRadius(CurrentlySelectableObject.transform, CurrentlySelectableObject.SelectableRadius);
            }
        }
        else
        {
            CurrentlySelectableObject = null;
            SelectableRadius.DisableViewRadius();
        }
    }