Beispiel #1
0
    public void SpawnWorldRootBAnchor()
    {
        worldRootBAnchor = FindObjectOfType <WorldRootBAnchor>();

        // Spawn if not found
        if (worldRootBAnchor == null)
        {
            WorldRootBAnchor worldRootBAnchorPrefab = Resources.Load <WorldRootBAnchor>(BConsts.PATH_AR_WorldRootBAnchor);
            if (IS_NOT_NULL(worldRootBAnchorPrefab))
            {
                worldRootBAnchor = Instantiate(worldRootBAnchorPrefab, Vector3.zero, Quaternion.identity);
            }
        }

        // Initialize
        if (IS_NOT_NULL(worldRootBAnchor))
        {
            worldRootBAnchor.BAnchorMovedToTracker += On_WorldRootBAnchor_BAnchorMovedToTracker;

            BAnchorCursorPlacer worldRootBAnchorCursorPlacer = worldRootBAnchor.GetComponent <BAnchorCursorPlacer>();
            if (IS_NOT_NULL(worldRootBAnchorCursorPlacer))
            {
                worldRootBAnchorCursorPlacer.EndedPlacing += On_WorldRootBAnchorCursorPlacer_EndedPlacing;
            }
            BEventsCollection.AR_WorldBAnchorSet.Invoke(new BEHandle <BAnchorInformation>(worldRootBAnchor.GetBAnchorInformation()));
        }
    }
Beispiel #2
0
 /// <summary>
 /// Called from BAnchorCursorPlacer to start placing a new BAnchor
 /// </summary>
 /// <param name="bAnchorToBePlaced"></param>
 /// <param name="bAnchorCursorPlacer"></param>
 /// <returns></returns>
 public bool OnStartPlacingBAnchor(BAnchorCursorPlacer bAnchorCursorPlacer, BAnchor bAnchorToBePlaced)
 {
     if (IS_NOT_NULL(bAnchorCursorPlacer) &&
         IS_NOT_NULL(bAnchorToBePlaced))
     {
         if (IsCurrenltyPlacingBAnchor == false)
         {
             CurrentBAnchorBeingPlaced = bAnchorToBePlaced;
             return(true);
         }
         else
         {
             LogConsoleWarning("Trying to select a new BAnchor for placement but one is already slected!");
         }
     }
     return(false);
 }
Beispiel #3
0
 /// <summary>
 /// Called from BAnchorCursorPlacer to stop placing a new BAnchor
 /// </summary>
 /// <param name="bAnchorToBePlaced"></param>
 /// <param name="bAnchorCursorPlacer"></param>
 /// <returns></returns>
 public bool OnStopPlacingBAnchor(BAnchorCursorPlacer bAnchorCursorPlacer, BAnchor bAnchorToBePlaced)
 {
     if (IS_NOT_NULL(bAnchorCursorPlacer) &&
         IS_NOT_NULL(bAnchorToBePlaced))
     {
         if (IsCurrenltyPlacingBAnchor == true)
         {
             if (CurrentBAnchorBeingPlaced == bAnchorToBePlaced)
             {
                 CurrentBAnchorBeingPlaced = null;
                 return(true);
             }
             else
             {
                 LogConsoleWarning("Trying to unselected a BAnchor for placement but another one was found already active!");
             }
         }
         else
         {
             LogConsoleWarning("Trying to unselected a BAnchor for placement but no BAnchor placement is currently active!");
         }
     }
     return(false);
 }