Example #1
0
 internal void SetUnderlay(UnderlayObjectData mObjectData)
 {
     if (mObjectData == null || IsDisabled || Blocked)
     {
         return;
     }
     if (Underlay)
     {
         GameObject old = Underlay.gameObject;
         Destroy(old);
     }
     if (StaticBlocker)
     {
         GameObject old = StaticBlocker.gameObject;
         DestroyImmediate(old);
     }
     Underlay = UnderlayObject.Create(this, mObjectData, MBoard.TargetCollectEventHandler);
     Underlay.SetToFront(false);
 }
Example #2
0
        /// <summary>
        /// Create new OverlayObject for gridcell
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="oData"></param>
        /// <param name="addCollider"></param>
        /// <param name="radius"></param>
        /// <param name="isTrigger"></param>
        /// <returns></returns>
        public static UnderlayObject Create(GridCell parent, UnderlayObjectData oData, Action <int> TargetCollectEvent)
        {
            if (!parent || oData == null)
            {
                return(null);
            }
            GameObject     gO         = null;
            SpriteRenderer sR         = null;
            UnderlayObject gridObject = null;

            sR = Creator.CreateSprite(parent.transform, oData.ObjectImage, parent.transform.position);
            gO = sR.gameObject;

            gridObject = gO.GetOrAddComponent <UnderlayObject>();
#if UNITY_EDITOR
            gO.name = "underlay " + parent.ToString();
#endif
            gridObject.SRenderer          = sR;
            gridObject.TargetCollectEvent = TargetCollectEvent;
            gridObject.SetData(oData);

            return(gridObject);
        }
Example #3
0
 internal virtual void SetData(UnderlayObjectData mData)
 {
     OData = mData;
     SetToFront(false);
 }
Example #4
0
        internal void SetObject(int ID)
        {
            IsDisabled = false;
            MatchObjectData mOD = GOSet.GetMainObject(ID);

            if (mOD != null)
            {
                SetMatchObject(mOD);
                return;
            }

            OverlayObjectData oOD = GOSet.GetOverlayObject(ID);

            if (oOD != null)
            {
                SetOverlay(oOD);
                return;
            }

            UnderlayObjectData uOD = GOSet.GetUnderlayObject(ID);

            if (uOD != null)
            {
                SetUnderlay(uOD);
                return;
            }

            DynamicClickBombObjectData cdOD = GOSet.GetDynamicClickBombObject(ID);

            if (cdOD != null)
            {
                SetDynamicClickBomb(cdOD);
                return;
            }

            if (ID == GOSet.FallingObject.ID)
            {
                SetFalling(GOSet.FallingObject);
                return;
            }

            BaseObjectData bOD = GOSet.GetObject(ID);

            if (bOD != null && GameObjectsSet.IsDisabledObject(bOD.ID))
            {
                SetDisabledObject(bOD);
                return;
            }

            if (bOD != null && GameObjectsSet.IsBlockedObject(bOD.ID))
            {
                SetBlockedObject(bOD);
            }

            DynamicBlockerData dbOD = GOSet.GetDynamicBlockerObject(ID);

            if (dbOD != null)
            {
                SetDynamicBlockerObject(dbOD);
                return;
            }

            StaticBlockerData sbOD = GOSet.GetStaticBlockerObject(ID);

            if (sbOD != null)
            {
                SetStaticBlockerObject(sbOD);
                return;
            }
        }