Esempio n. 1
0
        /// <summary>
        /// Select a vehicle in the loadout menu.
        /// </summary>
        /// <param name="index">The index of the newly selected vehicle in the display vehicles list.</param>
        void SelectVehicle(int index)
        {
            if (index == selectedVehicleIndex)
            {
                return;
            }

            int previousVehicleIndex = selectedVehicleIndex;

            selectedVehicleIndex = index;
            PlayerData.SaveSelectedVehicleIndex(selectedVehicleIndex);

            // Update the vehicle display
            displayManager.OnVehicleSelection(selectedVehicleIndex, previousVehicleIndex, itemManager);

            // Show ship stats
            loadoutStatsController.ShowStats(displayVehicles[selectedVehicleIndex]);

            // Update the module mount menu
            mountMenuController.UpdateButtons(displayVehicles[selectedVehicleIndex].ModuleMounts);

            // Focus on the first module mount
            if (displayVehicles[selectedVehicleIndex].ModuleMounts.Count > 0)
            {
                SelectModuleMount(0);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Event called when a new vehicle is selected in the loadout menu.
        /// </summary>
        /// <param name="index">The index of the newly selected vehicle.</param>
        /// <param name="playAudio">Whether to play the vehicle selection sound effect.</param>
        void OnSelectVehicle(int index, bool playAudio = true)
        {
            int previousVehicleIndex = selectedVehicleIndex;

            selectedVehicleIndex = index;
            PlayerData.SaveSelectedVehicleIndex(selectedVehicleIndex);

            // Prepare the UI
            shipNameText.text = displayVehicles[selectedVehicleIndex].Label;
            UpdateVehicleInfo();

            displayManager.OnVehicleSelection(selectedVehicleIndex, previousVehicleIndex, itemManager);

            // Update the mount menu
            mountMenuController.UpdateMenu(displayVehicles[selectedVehicleIndex]);
            focusedModuleMountIndex = displayVehicles[selectedVehicleIndex].ModuleMounts.Count > 0 ? 0 : -1;
            SelectModuleMount(focusedModuleMountIndex, false);

            if (playAudio)
            {
                PlayMenuAudio();
            }
        }