Пример #1
0
    public void OnMouseModeChanged(InputEnabled mode)
    {
        bool showTarget =
            eventsManager.mouseMode == InputEnabled.Disabled &&
            eventsManager.diggingMode == DiggingMode.NotDigging;

        target.gameObject.SetActive(showTarget);
    }
Пример #2
0
        /// <summary>
        /// Pop disabled input state. When the last disabled state is
        /// popped off the stack input will be re-enabled.
        /// </summary>
        public void PopInputDisable()
        {
            --disabledRefCount;
            Debug.Assert(disabledRefCount >= 0, "Tried to pop more input disable than the amount pushed.");

            if (disabledRefCount == 0)
            {
                InputEnabled.RaiseEvent();
            }
        }
Пример #3
0
        /// <summary>
        /// Clear the input disable stack, which will immediately re-enable input.
        /// </summary>
        public void ClearInputDisableStack()
        {
            bool wasInputDisabled = disabledRefCount > 0;

            disabledRefCount = 0;

            if (wasInputDisabled)
            {
                InputEnabled.RaiseEvent();
            }
        }
Пример #4
0
    public InputEnabled InvertMouseMode(InputEnabled mouseMode)
    {
        switch (mouseMode)
        {
        case InputEnabled.Disabled:
            return(InputEnabled.Enabled);

        case InputEnabled.Enabled:
            return(InputEnabled.Disabled);
        }
        return(InputEnabled.Enabled);
    }
Пример #5
0
    public void Start()
    {
        diggingMode = DiggingMode.NotDigging;
        mouseMode   = InputEnabled.Disabled;

        computerInputMode = InputEnabled.Disabled;
        computerInput     = FindObjectOfType <ComputerInput>();
        computerInput.gameObject.SetActive(false);

        deviceInputMode = InputEnabled.Disabled;
        deviceInput     = FindObjectOfType <DeviceInput>();
        deviceInput.gameObject.SetActive(false);
    }
Пример #6
0
    public void SetMouseMode(InputEnabled mouseMode)
    {
        switch (mouseMode)
        {
        case InputEnabled.Disabled:
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
            break;

        case InputEnabled.Enabled:
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;
            break;
        }
        MouseModeChanged(mouseMode);
    }
Пример #7
0
 public void MouseModeChanged(InputEnabled mouseMode)
 {
     this.mouseMode = mouseMode;
     OnMouseModeChanged?.Invoke(mouseMode);
 }
Пример #8
0
 internal void StopEditingDevice()
 {
     deviceInput.SetDevice(null);
     deviceInput.gameObject.SetActive(false);
     deviceInputMode = InputEnabled.Disabled;
 }
Пример #9
0
 public void StartEditingDevice(Device device)
 {
     deviceInput.SetDevice(device);
     deviceInput.gameObject.SetActive(true);
     deviceInputMode = InputEnabled.Enabled;
 }
Пример #10
0
 public void StopEditingComputer()
 {
     computerInput.SetComputer(null);
     computerInput.gameObject.SetActive(false);
     computerInputMode = InputEnabled.Disabled;
 }
Пример #11
0
 public void StartEditingComputer(Computer computer)
 {
     computerInput.SetComputer(computer);
     computerInput.gameObject.SetActive(true);
     computerInputMode = InputEnabled.Enabled;
 }
Пример #12
0
 public void DisableInputs()
 {
     inputEnabled = new InputEnabled(false, false, false, false, false, false, this);
 }
Пример #13
0
 public void EnableInputs()
 {
     inputEnabled = new InputEnabled(true, true, true, true, true, true, this);
 }