private void OnGripDown(Vector3 pointerPosAsScreenPos)
        {
            Debug.Log("OnGripDown");
            DeselectAll();
            onGripDown          = true;
            selectableUnits     = new List <WWObject>(FindObjectsOfType <WWObject>());
            initialDragPosition = new Vector2(pointerPosAsScreenPos.x, pointerPosAsScreenPos.y);
            selectionCanvasController.marqueeRectTransform.anchoredPosition = initialDragPosition;
            var hitWWObject = ToolUtilities.RaycastNoGrid(input.GetControllerPoint(), input.GetControllerDirection(), 200f);

            if (hitWWObject != null)
            {
                selectableUnits.Remove(hitWWObject);
                if (!wwObjectToOrigCoordinates.ContainsKey(hitWWObject))
                {
                    if (!ManagerRegistry.Instance.GetAnInstance <WWObjectGunManager>().GetDoFilter() ||
                        ManagerRegistry.Instance.GetAnInstance <WWObjectGunManager>().GetFilterType() ==
                        hitWWObject.ResourceMetadata.wwObjectMetadata.type)
                    {
                        wwObjectToOrigCoordinates.Add(hitWWObject, hitWWObject.GetCoordinate());
                        hitWWObject.Select();
                    }
                }
            }
        }
 private void PlaceObjects(Vector3 position)
 {
     if (OnlyMovingProps())
     {
         foreach (var kvp in wwObjectToOrigCoordinates)
         {
             var origOffset = CoordinateHelper.WWCoordToUnityCoord(kvp.Value);
             var y          = input.GetControllerPoint().y;
             var origin     = new Vector3(position.x + origOffset.x, y, position.z + origOffset.z);
             var stuckPoint = ToolUtilities.RaycastGridThenCustom(origin, Vector3.down,
                                                                  gridController.GetGridCollider(), WWType.Tile, 200f);
             var coord = CoordinateHelper.UnityCoordToWWCoord(stuckPoint);
             kvp.Key.SetPosition(coord);
         }
     }
     else
     {
         var delta = GetDeltaSnap(position);
         foreach (var kvp in wwObjectToOrigCoordinates)
         {
             var coord = CoordinateHelper.UnityCoordToWWCoord(
                 position + CoordinateHelper.WWCoordToUnityCoord(kvp.Value) + delta);
             kvp.Key.SetPosition(coord);
         }
     }
 }
        public void Update()
        {
            hitPoint = ToolUtilities.RaycastGridOnly(input.GetControllerPoint(),
                                                     input.GetControllerDirection(), gridController.GetGridCollider(), 200);

            // if we are placing a prop
            if (curObject != null && curObject.ResourceMetadata.wwObjectMetadata.type == WWType.Prop)
            { // raycast against all tiles and ignore the grid
                hitPoint = ToolUtilities.RaycastGridThenCustom(input.GetControllerPoint(),
                                                               input.GetControllerDirection(), gridController.GetGridCollider(), WWType.Tile, 200);
            }
        }
 public override void UpdateTrigger() // Update laser position.
 {
     hitPoint = ToolUtilities.RaycastGridThenCustom(input.GetControllerPoint(),
                                                    input.GetControllerDirection(), gridController.GetGridCollider(), WWType.Tile, 200);
     if (hitPoint != Vector3.zero)
     {
         var distance = Vector3.Distance(hitPoint, input.GetControllerPoint());
         DrawLaser(distance);
         shouldTeleport = true;
     }
     else
     {
         // Hide laser and reticle when no valid target is found.
         DeactivateLaser();
     }
 }
        private void Update()
        {
            var lastHitPoint = hitPoint;

            hitPoint = ToolUtilities.RaycastGridOnly(input.GetControllerPoint(),
                                                     input.GetControllerDirection(), gridController.GetGridCollider(), 200);
            if (OnlyMovingProps())
            {
                hitPoint = ToolUtilities.RaycastGridThenCustom(input.GetControllerPoint(),
                                                               input.GetControllerDirection(), gridController.GetGridCollider(), WWType.Tile, 200);
            }
            if (hitPoint.Equals(Vector3.zero))
            {
                hitPoint = lastHitPoint;
            }
            Debug.DrawLine(Vector3.zero, hitPoint, Color.red);
        }