예제 #1
0
        public bool Equals(InterObjectUnitID a)
        {
            if ((Object)a == null)
            {
                return(false);
            }

            return(m_Idx == a.m_Idx && m_Type == a.m_Type);
        }
예제 #2
0
        public InterObjectUnitID Copy()
        {
            InterObjectUnitID uid = new InterObjectUnitID();

            uid.m_Idx  = m_Idx;
            uid.m_Type = m_Type;

            return(uid);
        }
예제 #3
0
        public InterObject GetObject(InterObjectUnitID uid)
        {
            InterObject inter_object = null;

            if (m_InterObjects.TryGetValue(uid, out inter_object))
            {
                return(inter_object);
            }
            return(null);
        }
예제 #4
0
        public void DestroyObject(InterObjectUnitID uid)
        {
            InterObject inter_object = null;

            if (m_InterObjects.TryGetValue(uid, out inter_object))
            {
                inter_object.Destroy();
                m_InterObjects.Remove(uid);
            }
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }