您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
45 行
1.1 KiB
45 行
1.1 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace BossRoom.Viz
|
|
{
|
|
public class ModelSwap : MonoBehaviour
|
|
{
|
|
//!! DEBUG SCRIPT!
|
|
|
|
public GameObject[] modelArray;
|
|
public int m_ModelIndex = 0;
|
|
|
|
//debug; used for changing assets at runtime.
|
|
private int m_lastModelIndex = 0;
|
|
|
|
// Use this for initialization
|
|
void Start()
|
|
{
|
|
SetModel(m_ModelIndex);
|
|
}
|
|
|
|
public void SetModel(int index)
|
|
{
|
|
index = System.Math.Min(index, modelArray.Length - 1);
|
|
m_ModelIndex = index;
|
|
for (int x = 0; x < modelArray.Length; x++)
|
|
{
|
|
modelArray[x].SetActive(x == m_ModelIndex);
|
|
}
|
|
}
|
|
|
|
// Update is called once per frame
|
|
public void Update()
|
|
{
|
|
//DEBUG: This allows you to change models at runtime by tweaking the ModelIndex in the editor.
|
|
if( m_lastModelIndex != m_ModelIndex )
|
|
{
|
|
m_lastModelIndex = m_ModelIndex;
|
|
SetModel(m_ModelIndex);
|
|
}
|
|
}
|
|
}
|
|
}
|