/
Bruhh
/
Simulator
Обзор
Документация
Войти
/
Bruhh
/
Simulator
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
PCBuilderManager.cs
86 строк
2 KB
Bruhh
upload files
04 дек 2025, 08:25
04 дек 2025, 08:25
838886c
Код
Авторство
О чём код?
using System.Collections.Generic; using UnityEngine; public class PCBuilderManager : MonoBehaviour { public static PCBuilderManager Instance; public List<PCSocket> allSockets = new List<PCSocket>(); public List<PCComponent> allComponents = new List<PCComponent>(); [Header("UI")] public GameObject assemblyCompleteUI; public TMPro.TextMeshProUGUI progressText; private int installedComponents = 0; private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } } public void CheckAssemblyProgress() { installedComponents = 0; foreach (PCSocket socket in allSockets) { if (socket.installedComponent != null) installedComponents++; } UpdateProgressUI(); if (installedComponents == allSockets.Count) { CompleteAssembly(); } } private void UpdateProgressUI() { if (progressText != null) { progressText.text = $"Assembly Progress: {installedComponents}/{allSockets.Count}"; } } private void CompleteAssembly() { Debug.Log("PC Assembly Complete!"); if (assemblyCompleteUI != null) { assemblyCompleteUI.SetActive(true); } // Можно добавить дополнительные эффекты: звук, анимацию и т.д. } public void ResetAssembly() { foreach (PCSocket socket in allSockets) { socket.RemoveComponent(); } foreach (PCComponent component in allComponents) { component.ResetComponent(); } installedComponents = 0; UpdateProgressUI(); if (assemblyCompleteUI != null) { assemblyCompleteUI.SetActive(false); } } }