// Methods

        protected override void Awake()
        {
            base.Awake();

            // Set up Rewired vars
            mouse = ReInput.controllers.Mouse; // get the mouse

            // Set up Rewired Players
            int rewiredPlayerCount = rewiredPlayerIds.Length + (useRewiredSystemPlayer ? 1 : 0);

            players = new Rewired.Player[rewiredPlayerCount];
            for (int i = 0; i < rewiredPlayerIds.Length; i++)
            {
                players[i] = Rewired.ReInput.players.GetPlayer(rewiredPlayerIds[i]);
            }
            if (useRewiredSystemPlayer)
            {
                players[rewiredPlayerCount - 1] = Rewired.ReInput.players.GetSystemPlayer();
            }
        }
示例#2
0
    private void ManagmentState( )
    {
        //getMouse
        currentMouse = player.controllers.Mouse;

        /////////////////////LEFT CLICK////////////////////////////////
        if (player.GetButtonDown(Const.Input.Strings.LEFT_CLICK))
        {
            lmcClickPos = currentMouse.screenPosition;
            //cameraController.StartDrag(lmcClickPos);

            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(player.controllers.Mouse.screenPosition);
            if (Physics.Raycast(ray, out hit))
            {
                //select object if colided with something
                if (hit.collider.gameObject.GetComponent <Edificio>())
                {
                    //show its UI
                    UIController.Instance.HideUI();
                    hit.collider.gameObject.GetComponent <Edificio>().ShowUI();
                }
            }
        }
        //if button still down call drag events
        if (player.GetButton(Const.Input.Strings.LEFT_CLICK))
        {
            lmcCurrentPos = currentMouse.screenPosition;

            if (currentMouse.screenPositionDelta.magnitude > Const.Input.Params.mouseThresHold)
            {
                //Dragging
                //cameraController.MoveDrag(lmcCurrentPos);
            }
            else
            {
                //stoppped draggin
                lmcClickPos = lmcCurrentPos;
            }
        }

        /////////////////////RIGHT CLICK////////////////////////////////
        if (player.GetButtonDown(Const.Input.Strings.RIGHT_CLICK))
        {
            UIController.Instance.HideUI();
        }


        /////////////////////////////ARROW INPUTS/////////////////////////
        if (player.GetButton(Const.Input.Strings.CAM_UP) || (currentMouse.screenPosition.y >= Screen.height - borderThickness &&
                                                             currentMouse.screenPosition.y <= Screen.height + borderThickness))
        {
            cameraController.MoveZ(1);
        }
        else if (player.GetButton(Const.Input.Strings.CAM_DOWN) || (currentMouse.screenPosition.y <= 0 + borderThickness &&
                                                                    currentMouse.screenPosition.y >= 0 - borderThickness))
        {
            cameraController.MoveZ(-1);
        }
        if (player.GetButton(Const.Input.Strings.CAM_RIGHT) || (currentMouse.screenPosition.x >= Screen.width - borderThickness &&
                                                                currentMouse.screenPosition.x <= Screen.width + borderThickness))
        {
            cameraController.MoveX(1);
        }
        else if (player.GetButton(Const.Input.Strings.CAM_LEFT) || (currentMouse.screenPosition.x <= 0 + borderThickness &&
                                                                    currentMouse.screenPosition.x >= 0 - borderThickness))
        {
            cameraController.MoveX(-1);
        }

        ///////////////////////////////////MOUSE WHEEL////////////////////
        if (player.GetAxis(Const.Input.Strings.WHEEL) > 0)
        {
            cameraController.ZoomInOut(player.GetAxis(Const.Input.Strings.WHEEL));
        }
        else if (player.GetAxis(Const.Input.Strings.WHEEL) < 0)
        {
            cameraController.ZoomInOut(player.GetAxis(Const.Input.Strings.WHEEL));
        }
    }
        // Methods
        protected override void Awake()
        {
            base.Awake();

            // Set up Rewired vars
            mouse = ReInput.controllers.Mouse; // get the mouse

            // Set up Rewired Players
            int rewiredPlayerCount = rewiredPlayerIds.Length + (useRewiredSystemPlayer ? 1 : 0);
            players = new Rewired.Player[rewiredPlayerCount];
            for(int i = 0; i < rewiredPlayerIds.Length; i++) {
                players[i] = Rewired.ReInput.players.GetPlayer(rewiredPlayerIds[i]);
            }
            if(useRewiredSystemPlayer) players[rewiredPlayerCount - 1] = Rewired.ReInput.players.GetSystemPlayer();
        }