Exemple #1
0
        public void controlsGestion()
        {
            foreach (GTA.Control control in Enum.GetValues(typeof(GTA.Control)))
            {
                if (Game.IsControlJustPressed(2, control))
                {
                    OnControlDown?.Invoke(control);
                }

                if (Game.IsControlJustReleased(2, control))
                {
                    if (((IDictionary)lastTimeControlPressed).Contains(control) && (DemagoScript.getScriptTime() - lastTimeControlPressed[control]) < doublePressDelay)
                    {
                        lastTimeControlPressed[control] = 0;
                        OnControlDoublePressed?.Invoke(control);
                    }
                    else
                    {
                        OnControlPressed?.Invoke(control);
                    }

                    if (((IDictionary)lastTimeControlPressed).Contains(control))
                    {
                        lastTimeControlPressed[control] = DemagoScript.getScriptTime();
                    }
                    else
                    {
                        lastTimeControlPressed.Add(control, DemagoScript.getScriptTime());
                    }
                }
            }
        }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject())
        {
            OnControlDown?.Invoke(Input.mousePosition);
            OnControlDownWithOutParam?.Invoke();
        }

        if (Input.GetMouseButton(0) && !eventSystem.IsPointerOverGameObject())
        {
            OnControlOnDown?.Invoke(Input.mousePosition);
        }



        if (Input.GetMouseButtonUp(0) && !eventSystem.IsPointerOverGameObject())
        {
            OnControlUp?.Invoke(Input.mousePosition);
        }
    }