public void TryPlaceObject()
    {
        // Determine final validitiy of placement option
        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        bool valid = objectOnMouse.updateValidity(Physics.Raycast(ray, out hit, Eyesim.Scale, groundMask));

        if (valid && canPlaceObject)
        {
            // If it is new object, add to sim manager
            if (!objectOnMouse.isInit)
            {
                if (objectOnMouse is Robot)
                {
                    SimManager.instance.AddRobotToScene(objectOnMouse as Robot);
                }
                else if (objectOnMouse is WorldObject)
                {
                    SimManager.instance.AddWorldObjectToScene(objectOnMouse as WorldObject);
                }
                else if (objectOnMouse is Marker)
                {
                    SimManager.instance.AddMarkerToScene(objectOnMouse as Marker);
                }
            }
            // Place object physically
            objectOnMouse.PlaceObject();
            objectOnMouse   = null;
            canPlaceObject  = false;
            isMouseOccupied = false;
        }
    }
Beispiel #2
0
 public void PlaceObject()
 {
     print("placeit");
     objectOnMouse.PlaceObject();
     objectOnMouse = null;
 }