Exemplo n.º 1
0
        private void MouseMoveMap()
        {
            //todo dynamic
            if (!S.Game() || WindowsMgmt.Get().AnyOpenWindow())
            {
                return;
            }

            //Source: http://coffeebreakcodes.com/camera-movement-with-mouse-unity3d-c/

            if (Input.GetMouseButton(2))
            {
                if (Math.Abs(Input.GetAxis("Mouse X")) > 0.01)
                {
                    var p = new Vector3(Input.GetAxisRaw("Mouse X") * Time.deltaTime * speed,
                                        Input.GetAxisRaw("Mouse Y") * Time.deltaTime * speed, 0.0f);
                    //todo implement border check
                    _trans.position += p;
                }
            }

            if (Input.mousePosition.x > _width - _boundary && Input.mousePosition.x < _width + _boundary)
            {
                MoveCamera(1, 0);
            }

            if (Input.mousePosition.x < 0 + _boundary && Input.mousePosition.x > 0 - _boundary)
            {
                MoveCamera(-1, 0);
            }

            if (Input.mousePosition.y > _height - _boundary && Input.mousePosition.y < _height + _boundary)
            {
                MoveCamera(0, 1);
            }

            if (Input.mousePosition.y < 0 + _boundary && Input.mousePosition.y > 0 - _boundary)
            {
                MoveCamera(0, -1);
            }
        }
Exemplo n.º 2
0
        private void PressHidden(InputKey key)
        {
            switch (key.id)
            {
            case "moveUnitEast":
                _aUnit.MoveBy(-1, 0);
                break;

            case "moveUnitSouth":
                _aUnit.MoveBy(0, -1);
                break;

            case "moveUnitWest":
                _aUnit.MoveBy(1, 0);
                break;

            case "moveUnitNorth":
                _aUnit.MoveBy(0, +1);
                break;

            case "moveCameraEast":
                MoveCamera(-1, 0);
                break;

            case "moveCameraSouth":
                MoveCamera(0, -1);
                break;

            case "moveCameraWest":
                MoveCamera(1, 0);
                break;

            case "moveCameraNorth":
                MoveCamera(0, +1);
                break;

            case "zoomCameraIn":
                ZoomCamera(-1);
                break;

            case "zoomCameraOut":
                ZoomCamera(1);
                break;

            case "moveCameraLevelTop":
                GameMgmt.Get().newMap.view.ViewAdd(1);
                break;

            case "moveCameraLevelDown":
                GameMgmt.Get().newMap.view.ViewAdd(-1);
                break;

            case "closeWindow":
                WindowsMgmt.Get().GetAllOpenWindow().Last().DestroyWindow();
                break;

            default:
                OnMapUI.Get().ShowPanelMessageError($"{key.id} is not a valid call.");
                break;
            }
        }
Exemplo n.º 3
0
 public override bool Check(Player player, string sett)
 {
     return(Boolean.Parse(sett) == WindowsMgmt.Get().AnyOpenWindow());
 }