示例#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);
 }