You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.4 KiB
59 lines
1.4 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace DisComputer
|
|
{
|
|
/*
|
|
* @func 渲染零件容器
|
|
* @author lz
|
|
* @date 2020/07/09
|
|
*/
|
|
public class RendererSpareContainer : MonoBehaviour
|
|
{
|
|
//模型配置
|
|
public SpareModelConfig config;
|
|
|
|
[HideInInspector]
|
|
//当前渲染模型
|
|
public GameObject curRendererGo;
|
|
[HideInInspector]
|
|
public SpareInfo curSpareInfo;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 设置当前渲染零件
|
|
/// </summary>
|
|
/// <param name="info"></param>
|
|
public void SelectSpareRenderGo(SpareInfo info)
|
|
{
|
|
if (curRendererGo != null)
|
|
curRendererGo.SetActive(false);
|
|
|
|
|
|
for (int i = 0; i < config.spareModels.Count; i++)
|
|
{
|
|
//Debug.LogFormat("config.spareModels[i].name {0} info.name {1}", config.spareModels[i].name, info.name);
|
|
if(config.spareModels[i].name == info.name)
|
|
{
|
|
curRendererGo = config.spareModels[i].modelGo;
|
|
curSpareInfo = info;
|
|
curRendererGo.SetActive(true);
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|