Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.3 kB
9
Indexable
/// <summary>
        /// Inventory Next (for weapons etc)
        /// </summary>
        /// 
        
        public void OnInventoryNext(InputAction.CallbackContext context)
        {
            switch (context)
            {
                case { phase: InputActionPhase.Performed }:

                    float vec = context.ReadValue<Vector2>().y;
                    if(vec == -120)
                    {
                        previousInventoryKey++;
                        if(previousInventoryKey > 3)
                        {
                            previousInventoryKey = 0;
                        }

                    }
                    else if (vec == 120)
                    {
                        previousInventoryKey--;
                        if (previousInventoryKey < 0)
                        {
                            previousInventoryKey = 3;
                        }
                    }
                    intInventoryNext = intInvent[previousInventoryKey];
                    inputInventoryNext = true;
                    
                    break;
                case { phase: InputActionPhase.Canceled }:
                    inputInventoryNext = false;
                    break;

            }
        }