private void BakeNewSoul() { if (SoulCount > m_maxSoulNum) { Destroysoul(m_soulList[0]); } Transform _newsoulRoot = new GameObject().transform; for (int i = 0; i < skinmeshList.Count; i++) { Mesh _newmesh = m_meshBuffer[m_meshIndex]; m_meshIndex++; if (m_meshIndex >= m_meshBuffer.Count) { m_meshIndex = 0; } _newmesh.name = "Made in China"; GameObject _newGo = new GameObject(i.ToString()); skinmeshList[i].BakeMesh(_newmesh); _newGo.AddComponent <MeshFilter>().mesh = _newmesh; List <Material> materialList = new List <Material>(); for (int j = 0; j < _newmesh.subMeshCount; j++) { materialList.Add(m_soulMat); } _newGo.AddComponent <MeshRenderer>().sharedMaterials = materialList.ToArray(); _newGo.transform.position = skinmeshList[i].gameObject.transform.position; _newGo.transform.rotation = skinmeshList[i].gameObject.transform.rotation; _newGo.transform.parent = _newsoulRoot; } BattleSoul _newsoul = new BattleSoul(_newsoulRoot.gameObject, this, m_soulLife); m_soulList.Add(_newsoul); }
public void Destroysoul(BattleSoul soul) { m_soulList.Remove(soul); soul.Clear(); soul = null; }