示例#1
0
    private void HandleQuickSettingsInput()
    {
        addModeInput.Update();
        removeModeInput.Update();
        hideModeInput.Update();
        toggleGridObjSnap.Update();
        toggleAddingToOccupiedCell.Update();
        toggleAutoselectAboveHighestOccupied.Update();
        toggleKeepSameHeightLevel.Update();

        // Add mode
        if (addModeInput.JustPressedDown)
        {
            settings.EditMode = ObjectPlacer.EditMode.Add;
            UpdateModeHold(settings.EditMode, instant: leftShiftInput.PressedDown);
            SetIndicatorStates(settings.EditMode);
        }
        // Remove mode
        else if (removeModeInput.JustPressedDown)
        {
            settings.EditMode = ObjectPlacer.EditMode.Remove;
            UpdateModeHold(settings.EditMode, instant: leftShiftInput.PressedDown);
            SetIndicatorStates(settings.EditMode);
        }
        // Hide mode
        else if (hideModeInput.JustPressedDown)
        {
            settings.EditMode = ObjectPlacer.EditMode.Hide;
            UpdateModeHold(settings.EditMode, instant: leftShiftInput.PressedDown);
            SetIndicatorStates(settings.EditMode);
        }
        // Grid object snap toggle
        else if (toggleGridObjSnap.JustPressedDown)
        {
            settings.GridObjSnapActive = !settings.GridObjSnapActive;
            Debug.Log("GridObjSnapActive: " + settings.GridObjSnapActive);
        }
        // Adding to occupied cell toggle
        else if (toggleAddingToOccupiedCell.JustPressedDown)
        {
            settings.AddingToOccupiedCellActive =
                !settings.AddingToOccupiedCellActive;
            Debug.Log("AddingToOccupiedCellActive: " +
                      settings.AddingToOccupiedCellActive);
        }
        // Autoselecting above highest occupied cell toggle
        else if (toggleAutoselectAboveHighestOccupied.JustPressedDown)
        {
            settings.AutoselectAboveHighestOccupiedCellActive =
                !settings.AutoselectAboveHighestOccupiedCellActive;

            if (settings.AutoselectAboveHighestOccupiedCellActive)
            {
                objPlacer.RepositionPreviewObject(mouse.Coordinates);
            }

            Debug.Log("AutoselectAboveHighestOccupiedCellActive: " +
                      settings.AutoselectAboveHighestOccupiedCellActive);
        }
        // Keep same height level toggle
        else if (toggleKeepSameHeightLevel.JustPressedDown)
        {
            settings.KeepSameHeightLevelOnUnevenTerrainActive =
                !settings.KeepSameHeightLevelOnUnevenTerrainActive;

            if (settings.KeepSameHeightLevelOnUnevenTerrainActive)
            {
                objPlacer.UpdatePreferredHeight();
            }

            Debug.Log("KeepSameHeightLevelOnUnevenTerrainActive: "
                      + settings.KeepSameHeightLevelOnUnevenTerrainActive);
        }
    }