Exemple #1
0
    private void HandleObjPlacingInput()
    {
        bool add    = mouse.LeftButtonReleased;
        bool remove = mouse.RightButtonReleased;

        matchHeightLevelInput.Update();

        if (add || remove)
        {
            if (leftShiftInput.PressedDown)
            {
                if (add)
                {
                    objPlacer.PickObject(mouse.SelectedObject as HexObject);
                }
                else if (remove)
                {
                    objPlacer.MatchRotation(mouse.SelectedObject as HexObject);
                }
            }
            else if (leftCtrlInput.PressedDown)
            {
                grid.HideObjectsInCell(objPlacer.Coordinates, true, objPlacer.HeightLevelRoundedDown);
            }
            else if (leftAltInput.PressedDown)
            {
                if (add)
                {
                    objPlacer.AddOrRemoveObjectInSelectedCell(true, false);
                }
                else if (remove)
                {
                    objPlacer.AddOrRemoveObjectInSelectedCell(true, true);
                }
            }
            else
            {
                objPlacer.AddOrRemoveObjectInSelectedCell(false, remove);
            }
        }
        // Match height level
        else if (matchHeightLevelInput.JustPressedDown)
        {
            // TODO: Annoyingly preview movement and height change happen in different frames

            if (mouse.SelectedObject is HexObject)
            {
                objPlacer.HeightLevel = mouse.SelectedObject.HeightLevel;
                objPlacer.UpdatePreferredHeight();
            }
        }
    }