Ejemplo n.º 1
0
            // Moves the visualizer prefab to a position based on the current mouse position
            public static void UpdateVisualizerPosition()
            {
                // If a tool is selected
                if (Interface.placementMode != Interface.PlacementMode.None)
                {
                    // If visualizer exists
                    if (visualizerGameObject != null)
                    {
                        // Update visualizer position from pointer location on grid
                        visualizerGameObject.transform.position =
                            Helper.GetPositionOnGridClosestToMousePointer();

                        // If Eraser tool is not selected
                        if (Settings.Data.gui.toolbar.selectedDrawToolIndex != 4)
                        {
                            // Apply position offset
                            visualizerGameObject.transform.position += Helper.GetOffsetPosition();

                            // If Randomizer is selected
                            if (Settings.Data.gui.toolbar.selectedDrawToolIndex == 3)
                            {
                                // If Prefab in randomizable, apply Randomizer to transform
                                if (Helper.Randomizer.GetUseRandomizer())
                                {
                                    visualizerGameObject = Randomizer.ApplyRandomizerToTransform(
                                        visualizerGameObject, Manipulate.GetCurrentRotation());
                                }
                            }
                        }

                        // Set visualizer visibility based on if mouse over grid
                        if (pointerInSceneview)
                        {
                            visualizerGameObject.SetActive(visualizerOnGrid);
                        }
                    }
                }
            }