/
Bruhh
/
Simulator
Обзор
Документация
Войти
/
Bruhh
/
Simulator
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
PCComponent.cs
52 строки
1 KB
Bruhh
upload files
04 дек 2025, 08:25
04 дек 2025, 08:25
838886c
Код
Авторство
О чём код?
using UnityEngine; public class PCComponent : MonoBehaviour { public string componentType; // "CPU", "GPU", "RAM", etc. public bool IsInstalled { get; private set; } public Vector3 installedRotation; private Vector3 originalPosition; private Quaternion originalRotation; private Transform originalParent; private Rigidbody rb; private Collider col; private void Awake() { rb = GetComponent<Rigidbody>(); col = GetComponent<Collider>(); originalPosition = transform.position; originalRotation = transform.rotation; originalParent = transform.parent; } public void OnPickedUp() { col.enabled = false; IsInstalled = false; } public void OnInstalled() { IsInstalled = true; col.enabled = true; rb.isKinematic = true; } public void OnDropped() { col.enabled = true; rb.isKinematic = false; } public void ResetComponent() { transform.SetParent(originalParent); transform.position = originalPosition; transform.rotation = originalRotation; rb.isKinematic = false; col.enabled = true; IsInstalled = false; } }