void Update()
    {
        //if (!GameStates.gameActive) return;
        // Get device type
        if (SystemInfo.deviceType == DeviceType.Desktop)
        {
            // Input for keyboard (mostly for testing purposes)
            float horizontal = Input.GetAxisRaw("Horizontal");

            if (Input.GetMouseButton(0))
            {
                ps.Aim();
                //if (OnStateChange != null) OnStateChange(PlayerStates.firingWeapon);
            }
            else if (Input.GetMouseButtonUp(0))
            {
                ps.StopAim();
            }

            if ((Input.GetKeyDown(KeyCode.Space)) || (Input.GetMouseButtonDown(1)))
            {
                if (OnStateChange != null)
                {
                    OnStateChange(PlayerStates.jump);
                }
            }
            if (horizontal != 0f)
            {
                if (horizontal < 0f)
                {
                    if (OnStateChange != null)
                    {
                        OnStateChange(PlayerStates.left);
                    }
                    facingRight = !facingRight;
                }
                else
                {
                    if (OnStateChange != null)
                    {
                        OnStateChange(PlayerStates.right);
                    }
                    facingRight = !facingRight;
                }
            }
            else
            {
                if (OnStateChange != null)
                {
                    OnStateChange(PlayerStates.idle);
                }
            }
        }
        else if (SystemInfo.deviceType == DeviceType.Handheld)
        {
            // Mobile input
            if (SimpleInput.GetButton("Attack"))
            {
                ps.Aim();
                //if (OnStateChange != null) OnStateChange(PlayerStates.firingWeapon);
            }
            else if (SimpleInput.GetButtonUp("Attack"))
            {
                ps.StopAim();
            }

            if (SimpleInput.GetButtonDown("Jump"))
            {
                if (OnStateChange != null)
                {
                    OnStateChange(PlayerStates.jump);
                }
            }

            if (SimpleInput.GetButton("Left"))
            {
                if (OnStateChange != null)
                {
                    OnStateChange(PlayerStates.left);
                }
            }
            else if (SimpleInput.GetButton("Right"))
            {
                if (OnStateChange != null)
                {
                    OnStateChange(PlayerStates.right);
                }
            }
            else
            {
                if (OnStateChange != null)
                {
                    OnStateChange(PlayerStates.idle);
                }
            }
        }
    }