Exemple #1
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void CheckNavigation()
    {
        ///////////Type
        if (Input.GetAxis("Vertical") > 0.2f && !snaped)
        {
            selectedType--;
            print("type = " + nfmod(selectedType, 4));
            ui.UpdateArrows(nfmod(selectedType, 4), nfmod(selectedType + 1, 4));
            snaped   = true;
            aS.pitch = 1f;
            aS.PlayOneShot(switchTypeSFX);
        }

        if (Input.GetAxis("Vertical") < -0.2f && !snaped)
        {
            selectedType++;
            print("type = " + nfmod(selectedType, 4));
            ui.UpdateArrows(nfmod(selectedType, 4), nfmod(selectedType - 1, 4));
            snaped   = true;
            aS.pitch = 1f;
            aS.PlayOneShot(switchTypeSFX);
        }

        if (Input.GetAxis("Horizontal") > 0.2f && !snaped)
        {
            int modType = nfmod(selectedType, 4);
            if (modType < 3)
            {
                selectedParts [modType]++;
                UpdateVisualisation(modType, playerInventory.GetIDFromReference(modType, nfmod(selectedParts [modType], playerInventory.GetArrayLength(modType))));
            }
            else
            {
                selectedMemento++;
                currentMemento = playerInventory.mementos[nfmod(selectedMemento, playerInventory.mementos.Count)];
                ui.UpdateName(currentMemento);
                UpdateVisualisation(modType, currentMemento.ID);
            }
            aS.pitch = 1f;
            aS.PlayOneShot(switchPartSFX);
            snaped = true;
        }

        if (Input.GetAxis("Horizontal") < -0.2f && !snaped)
        {
            int modType = nfmod(selectedType, 4);
            if (modType < 3)
            {
                selectedParts [modType]--;
                UpdateVisualisation(modType, playerInventory.GetIDFromReference(modType, nfmod(selectedParts [modType], playerInventory.GetArrayLength(modType))));
            }
            else
            {
                selectedMemento--;
                currentMemento = playerInventory.mementos[nfmod(selectedMemento, playerInventory.mementos.Count)];
                ui.UpdateName(currentMemento);
                UpdateVisualisation(modType, currentMemento.ID);
            }
            aS.pitch = 0.999f;
            aS.PlayOneShot(switchPartSFX);
            snaped = true;
        }
        /////////Reset input
        if ((Input.GetAxis("Vertical") < 0.2f && Input.GetAxis("Vertical") > -0.2f) &&
            (Input.GetAxis("Horizontal") < 0.2f && Input.GetAxis("Horizontal") > -0.2f))
        {
            snaped = false;
        }
    }