public bool Equals(InterObjectUnitID a) { if ((Object)a == null) { return(false); } return(m_Idx == a.m_Idx && m_Type == a.m_Type); }
public InterObjectUnitID Copy() { InterObjectUnitID uid = new InterObjectUnitID(); uid.m_Idx = m_Idx; uid.m_Type = m_Type; return(uid); }
public InterObject GetObject(InterObjectUnitID uid) { InterObject inter_object = null; if (m_InterObjects.TryGetValue(uid, out inter_object)) { return(inter_object); } return(null); }
public void DestroyObject(InterObjectUnitID uid) { InterObject inter_object = null; if (m_InterObjects.TryGetValue(uid, out inter_object)) { inter_object.Destroy(); m_InterObjects.Remove(uid); } }
/// <summary> /// 获取唯一ID /// </summary> /// <returns></returns> public InterObjectUnitID GetUID(InterObjectType type) { uint idx = 0; m_CurrentIdxs.TryGetValue(type, out idx); InterObjectUnitID uid = new InterObjectUnitID(); uid.m_Type = type; uid.m_Idx = idx; m_CurrentIdxs[type] = idx + 1; return(uid); }
public override bool Equals(Object obj) { if (obj == null) { return(false); } if ((obj.GetType().Equals(GetType())) == false) { return(false); } InterObjectUnitID uid = (InterObjectUnitID)obj; return(m_Idx == uid.m_Idx && m_Type == uid.m_Type); }
public T CreateObject <T>(InterObjectUnitID uid, string res_path, Vector3 pos, Quaternion rot, Vector3 scale) where T : InterObject { if (m_InterObjects.ContainsKey(uid)) { Debug.LogError("m_InterObjects's key conflict. uid: " + uid); return(m_InterObjects[uid] as T); } T inter_object = Activator.CreateInstance <T>(); inter_object.OnCreate(); m_InterObjects.Add(uid, inter_object); inter_object.CreateModel(res_path, pos, rot, scale); return(inter_object); }