Beispiel #1
0
        /// <summary>
        /// Destroy GameObject and remove from cache specific instance of DropObject
        /// </summary>
        /// <param name="dropObject"></param>
        public void Destroy(DropObject dropObject)
        {
            if (!DropObjectsCache.ContainsKey(dropObject.Id))
            {
                Destroy(dropObject.gameObject);
                return;
            }

            Destroy(DropObjectsCache[dropObject.Id].gameObject);
            DropObjectsCache.Remove(dropObject.Id);
        }
Beispiel #2
0
        /// <summary>
        /// Attach events and Cache specific DropObject in <see cref="DropObjectsCache"/>
        /// </summary>
        /// <param name="dropObject"></param>
        public void CacheDropObject(DropObject dropObject)
        {
            PrepareDropEvents(dropObject);

            Guid id = dropObject.Id;

            if (!DropObjectsCache.ContainsKey(id))
            {
                DropObjectsCache.Add(id, null);
            }

            DropObjectsCache[id]          = dropObject;
            DropObjectsCache[id].IsCached = true;
        }