115 lines
2.5 KiB
C#
115 lines
2.5 KiB
C#
using UnityEngine;
|
|
using AibisDream.SaveSystem;
|
|
|
|
public class UFModule : MonoBehaviour
|
|
{
|
|
private GameObject _ufCover;
|
|
private GameObject _ufModule;
|
|
private GameObject _ufSocket;
|
|
private GameObject _ufColor;
|
|
|
|
private bool _isUFCoverRemoved;
|
|
private bool _isUFRemoved;
|
|
private bool _isColorRemoved;
|
|
|
|
private void Awake()
|
|
{
|
|
_ufModule = transform.Find("Module Pic").gameObject;
|
|
_ufSocket = transform.Find("Socket").gameObject;
|
|
_ufCover = _ufModule.transform.Find("Cover").gameObject;
|
|
_ufColor = _ufModule.transform.Find("Color").gameObject;
|
|
}
|
|
|
|
public void RemoveUFCover()
|
|
{
|
|
if (_ufCover.activeInHierarchy)
|
|
{
|
|
_ufCover.SetActive(false);
|
|
}
|
|
|
|
_isUFCoverRemoved = true;
|
|
}
|
|
|
|
public void RemoveUFModule()
|
|
{
|
|
if (_ufModule.activeInHierarchy)
|
|
{
|
|
_ufModule.SetActive(false);
|
|
_ufSocket.SetActive(false);
|
|
}
|
|
|
|
_isUFRemoved = true;
|
|
}
|
|
|
|
public void InstallUFCover()
|
|
{
|
|
if (!_ufCover.activeInHierarchy)
|
|
{
|
|
_ufCover.SetActive(true);
|
|
}
|
|
|
|
_isUFCoverRemoved = false;
|
|
}
|
|
|
|
public void InstallUFModule()
|
|
{
|
|
if (!_ufModule.activeInHierarchy)
|
|
{
|
|
_ufModule.SetActive(true);
|
|
_ufSocket.SetActive(true);
|
|
}
|
|
|
|
_isUFRemoved = false;
|
|
}
|
|
|
|
public void InstallUFColor()
|
|
{
|
|
if (!_ufColor.activeInHierarchy)
|
|
{
|
|
_ufColor.SetActive(true);
|
|
}
|
|
|
|
_isColorRemoved = false;
|
|
}
|
|
|
|
public void RemoveUFColor()
|
|
{
|
|
if (_ufColor.activeInHierarchy)
|
|
{
|
|
_ufColor.SetActive(false);
|
|
}
|
|
|
|
_isColorRemoved = true;
|
|
}
|
|
|
|
public void CaptureState(BodyModuleSnapshotDto dto)
|
|
{
|
|
if (dto == null) return;
|
|
dto.isUFCoverRemoved = _isUFCoverRemoved;
|
|
dto.isUFRemoved = _isUFRemoved;
|
|
dto.isColorRemoved = _isColorRemoved;
|
|
}
|
|
|
|
public void ApplyState(BodyModuleSnapshotDto dto)
|
|
{
|
|
if (dto == null) return;
|
|
_isUFCoverRemoved = dto.isUFCoverRemoved;
|
|
_isUFRemoved = dto.isUFRemoved;
|
|
_isColorRemoved = dto.isColorRemoved;
|
|
UFinit();
|
|
}
|
|
|
|
public void UFinit()
|
|
{
|
|
_ufModule.SetActive(!_isUFRemoved);
|
|
_ufSocket.SetActive(!_isUFRemoved);
|
|
_ufCover.SetActive(!_isUFCoverRemoved);
|
|
_ufColor.SetActive(!_isColorRemoved);
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
UFinit();
|
|
}
|
|
}
|