SetModelScaleAction.ArchitectureScale GetNearestEnumValue(float value)
        {
            SetModelScaleAction.ArchitectureScale returnValue = SetModelScaleAction.ArchitectureScale.OneToOne;
            float distance = float.MaxValue;

            foreach (var enumValue in m_ScaleValues)
            {
                var newValue = Math.Abs(value - Convert.ToSingle(enumValue));
                if (newValue < distance)
                {
                    returnValue = (SetModelScaleAction.ArchitectureScale)enumValue;
                    distance    = newValue;
                }
            }

            return(returnValue);
        }
Exemple #2
0
 public ARPlacementStateData(GameObject modelFloor, GameObject firstSelectedPlane, GameObject secondSelectedPlane, Vector3 modelPlacementLocation,
                             GameObject arFloor, GameObject firstARSelectedPlane, GameObject secondARSelectedPlane, Vector3 arPlacementLocation, Vector3 arPlacementAlignment,
                             SetModelFloorAction.PlacementRule placementRule, bool validTarget, float beamHeight, SetModelScaleAction.ArchitectureScale modelScale, Transform placementRoot,
                             GameObject placementRulesGameObject, List <GameObject> placementRulesPrefabs, Transform boundingBoxRootNode)
 {
     this.modelFloor             = modelFloor;
     this.firstSelectedPlane     = firstSelectedPlane;
     this.secondSelectedPlane    = secondSelectedPlane;
     this.modelPlacementLocation = modelPlacementLocation;
     this.arFloor = arFloor;
     this.firstARSelectedPlane     = firstARSelectedPlane;
     this.secondARSelectedPlane    = secondARSelectedPlane;
     this.arPlacementLocation      = arPlacementLocation;
     this.arPlacementAlignment     = arPlacementAlignment;
     this.placementRule            = placementRule;
     this.validTarget              = validTarget;
     this.beamHeight               = beamHeight;
     this.modelScale               = modelScale;
     this.placementRoot            = placementRoot;
     this.placementRulesGameObject = placementRulesGameObject;
     this.placementRulesPrefabs    = placementRulesPrefabs;
     this.boundingBoxRootNode      = boundingBoxRootNode;
     showModel = true;
     showBoundingBoxModelAction = false;
 }
Exemple #3
0
 public static string FormatScaleText(SetModelScaleAction.ArchitectureScale scale)
 {
     return($"1 : {(int)scale}");
 }
Exemple #4
0
        public static float GetFloatFromScale(SetModelScaleAction.ArchitectureScale scale)
        {
            var index = Array.IndexOf(Enum.GetValues(typeof(SetModelScaleAction.ArchitectureScale)), scale);

            return(index);
        }
Exemple #5
0
 void OnModelScaleChanged(SetModelScaleAction.ArchitectureScale newData)
 {
     m_ScaleDialControl.selectedValue = GetFloatFromScale(newData);
     m_ARScaleText.text = FormatScaleText(newData);
 }