internal void UpdateWithAxes(float x, float y, ulong updateTick, float deltaTime)
        {
            lastState = thisState;
            lastValue = thisValue;

            thisValue = Raw ? new Vector2(x, y) : Utility.ApplyCircularDeadZone(x, y, LowerDeadZone, UpperDeadZone);

            X = thisValue.x;
            Y = thisValue.y;

            Left.CommitWithValue(Mathf.Max(0.0f, -X), updateTick, deltaTime);
            Right.CommitWithValue(Mathf.Max(0.0f, X), updateTick, deltaTime);

            if (InputManager.InvertYAxis)
            {
                Up.CommitWithValue(Mathf.Max(0.0f, -Y), updateTick, deltaTime);
                Down.CommitWithValue(Mathf.Max(0.0f, Y), updateTick, deltaTime);
            }
            else
            {
                Up.CommitWithValue(Mathf.Max(0.0f, Y), updateTick, deltaTime);
                Down.CommitWithValue(Mathf.Max(0.0f, -Y), updateTick, deltaTime);
            }

            thisState = Up.State || Down.State || Left.State || Right.State;

            if (clearInputState)
            {
                lastState       = thisState;
                lastValue       = thisValue;
                clearInputState = false;
                HasChanged      = false;
                return;
            }

            if (thisValue != lastValue)
            {
                UpdateTick = updateTick;
                HasChanged = true;
            }
            else
            {
                HasChanged = false;
            }

            if ((X != 0 || Y != 0) && OnMoveHandler != null)
            {
                OnMoveHandler();
            }
        }
Exemple #2
0
        internal void UpdateWithAxes(float x, float y)
        {
            lastState = thisState;
            lastValue = thisValue;

            thisValue = Raw ? new Vector2(x, y) : Utility.ApplyCircularDeadZone(x, y, LowerDeadZone, UpperDeadZone);

            X = thisValue.X;
            Y = thisValue.Y;

            Left.CommitWithValue(Math.Max(0.0f, -X));
            Right.CommitWithValue(Math.Max(0.0f, X));

            if (InputManager.InvertYAxis)
            {
                Up.CommitWithValue(Math.Max(0.0f, -Y));
                Down.CommitWithValue(Math.Max(0.0f, Y));
            }
            else
            {
                Up.CommitWithValue(Math.Max(0.0f, Y));
                Down.CommitWithValue(Math.Max(0.0f, -Y));
            }

            thisState = Up.State || Down.State || Left.State || Right.State;

            if (clearInputState)
            {
                lastState       = thisState;
                lastValue       = thisValue;
                clearInputState = false;
                HasChanged      = false;
                return;
            }

            if (thisValue != lastValue)
            {
                UpdateTick = Time.frameCount;
                HasChanged = true;
            }
            else
            {
                HasChanged = false;
            }
        }
        internal void UpdateWithAxes(float x, float y, ulong updateTick, float deltaTime)
        {
            lastState = thisState;
            lastValue = thisValue;

            if (Raw)
            {
                thisValue = new Vector2(x, y);
            }
            else
            {
                thisValue = Utility.ApplyCircularDeadZone(x, y, LowerDeadZone, UpperDeadZone);
            }

            X = thisValue.x;
            Y = thisValue.y;

            Left.CommitWithValue(Mathf.Max(0.0f, -X), updateTick, deltaTime);
            Right.CommitWithValue(Mathf.Max(0.0f, X), updateTick, deltaTime);

            if (InputManager.InvertYAxis)
            {
                Up.CommitWithValue(Mathf.Max(0.0f, -Y), updateTick, deltaTime);
                Down.CommitWithValue(Mathf.Max(0.0f, Y), updateTick, deltaTime);
            }
            else
            {
                Up.CommitWithValue(Mathf.Max(0.0f, Y), updateTick, deltaTime);
                Down.CommitWithValue(Mathf.Max(0.0f, -Y), updateTick, deltaTime);
            }

            thisState = Up.State || Down.State || Left.State || Right.State;

            if (thisValue != lastValue)
            {
                UpdateTick = updateTick;
                HasChanged = true;
            }
            else
            {
                HasChanged = false;
            }
        }
Exemple #4
0
    internal void UpdateWithAxes(float x, float y, ulong updateTick, float deltaTime)
    {
        lastState = thisState;
        lastValue = thisValue;

        thisValue = new Vector2(x, y);

        X = thisValue.x;
        Y = thisValue.y;

        Left.CommitWithValue(Mathf.Max(0.0f, -X), updateTick, deltaTime);
        Right.CommitWithValue(Mathf.Max(0.0f, X), updateTick, deltaTime);

        Up.CommitWithValue(Mathf.Max(0.0f, Y), updateTick, deltaTime);
        Down.CommitWithValue(Mathf.Max(0.0f, -Y), updateTick, deltaTime);

        thisState = Up.State || Down.State || Left.State || Right.State;

        if (clearInputState)
        {
            lastState       = thisState;
            lastValue       = thisValue;
            clearInputState = false;
            HasChanged      = false;
            return;
        }

        if (thisValue != lastValue)
        {
            UpdateTick = updateTick;
            HasChanged = true;
        }
        else
        {
            HasChanged = false;
        }
    }