コード例 #1
0
        /// <summary>
        /// Attempt to Add a WWObject to the data structure.
        /// </summary>
        /// <param name="wwObject">The object to Add.</param>
        /// <returns>True if the object can be Added to the data structure.</returns>
        public bool Add(WWObject wwObject)
        {
            Coordinate coord = wwObject.GetCoordinate();
            Guid       guid  = wwObject.GetId();

            if (Collides(wwObject) && wwObject.ResourceMetadata.wwObjectMetadata.type.Equals(WWType.Tile))
            {
                Debug.Log("Tile collides with existing tiles. Preventing placement of new tile.");
                return(false);
            }
            if (coordinates.ContainsKey(coord.Index))
            {
                coordinates[coord.Index].Add(guid); // append the existing list of Guids for this index
            }
            else // create new entry in the map
            {
                var guidList = new List <Guid>();
                guidList.Add(guid);
                coordinates.Add(coord.Index, guidList);
            }
            objects.Add(wwObject.GetId(), wwObject);
            return(true); // sucessfully added the object to the data structure
        }
コード例 #2
0
 // Grip
 public override void OnUngrip() // Delete object
 {
     if (curObject == null)
     {
         RaycastHit raycastHit;
         if (Physics.Raycast(input.GetControllerPoint(), input.GetControllerDirection(), out raycastHit, 100))
         {
             WWObject wwObject = raycastHit.transform.gameObject.GetComponent <WWObject>();
             if (wwObject != null)
             {
                 ManagerRegistry.Instance.GetAnInstance <SceneGraphManager>().Delete(wwObject.GetId());
             }
         }
     }
 }