Ejemplo n.º 1
0
    protected override void OnMove(InputAction.CallbackContext context)
    {
        if (isReady)
        {
            return;
        }

        Vector2 input = context.ReadValue <Vector2>();

        if (input.x != 0)
        {
            switch (cursorIndex)
            {
            case 0:
                colorIndex += (int)input.normalized.x;
                colorIndex  = MathUtils.Mod(colorIndex, colors.Length);
                UpdateColor();
                break;

            case 1:
                hatIndex += (int)input.normalized.x;
                hatIndex  = MathUtils.Mod(hatIndex, hatModels.Length + 1);
                if (_currentHat != null)
                {
                    Destroy(_currentHat);
                }
                if (hatIndex != hatModels.Length)     //Keep one slot open for no hat
                {
                    _currentHat = Instantiate(hatModels[hatIndex], currentHybrid.hatParent);
                }
                break;

            default:
                break;
            }
        }
        else
        {
            cursorIndex = _outfitList.Move(-(int)input.normalized.y);
        }
        _outfitList.AnimateButton(input.normalized);
    }