public CSCreator MultiCreateCreator(int TeamNum) { if (otherCreators.ContainsKey(TeamNum)) { Debug.Log("This TeamNum [" + TeamNum.ToString() + "] is exsit"); return(null); } CSCreator creator = null; GameObject go = new GameObject(); go.transform.parent = transform; go.name = "Team " + TeamNum + " Managed Creator"; go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; CSMgCreator mgCreator = go.AddComponent <CSMgCreator>(); creator = mgCreator; CSConst.CreatorType type = CSConst.CreatorType.Managed; creator.m_DataInst = CSDataMgr.CreateDataInst(TeamNum, type); mgCreator.m_Clod = CSClodsMgr.CreateClod(TeamNum); mgCreator.teamNum = TeamNum; otherCreators.Add(TeamNum, creator); return(creator); }
public CSCreator CreateCreator(int ID, string desc, CSConst.CreatorType type = CSConst.CreatorType.Managed) { if (m_Creators.ContainsKey(ID)) { Debug.Log("This ID [" + ID.ToString() + "] is exsit"); return(null); } CSCreator creator = null; if (type == CSConst.CreatorType.Managed) { GameObject go = new GameObject(); go.transform.parent = transform; go.name = desc; go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; CSMgCreator mgCreator = go.AddComponent <CSMgCreator>(); creator = mgCreator; creator.m_DataInst = CSDataMgr.CreateDataInst(ID, type); mgCreator.m_Clod = CSClodsMgr.CreateClod(ID); m_Creators.Add(ID, creator); } else if (type == CSConst.CreatorType.NoManaged) { GameObject go = new GameObject(); go.transform.parent = transform; go.name = desc; go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; creator = go.AddComponent <CSNoMgCreator>(); creator.m_DataInst = CSDataMgr.CreateDataInst(ID, type); m_Creators.Add(ID, creator); } return(creator); }