Esempio n. 1
0
        private IEnumerator CascadeJewelFromQueue()
        {
            IRuntimeJewel jq = JewelsToFall.Dequeue();

            Vector2 BoardTo   = BoardPos.OffsetJewelByPosition(jq.Pos);
            Vector2 BoardFrom = BoardPos.OffsetJewelByPosition(jq.LastPos);

            Vector3 to   = BoardPos.GetNextJewelPosition(BoardTo, utils.DeckPosition.position);
            Vector3 from = jq.IsNew() ? new Vector3(to.x, BoardPos.GetBoardTopPos().y, to.z)
        : new Vector3(to.x, BoardPos.GetNextJewelPosition(BoardFrom, utils.DeckPosition.position).y, to.z);

            if (jq.IsNew())
            {
                var uiJewel             = UiJewelPool.Instance.Get(jq);
                IUiJewelComponents comp = uiJewel.MonoBehavior.GetComponent <IUiJewelComponents>();
                //comp.UIRuntimeData.OnSetData(jq);
                uiJewel.MonoBehavior.name  = jq.JewelID;
                uiJewel.transform.position = from;
                utils.PlayerBoard.AddJewel(uiJewel);
            }

            yield return(new WaitForSeconds(utils.JEWELFALLDELAY));

            if (jq.IsNew() || jq.LastPos.y != jq.Pos.y)
            {
                OnNotifyPositionChange(jq, from, to);
            }

            if (JewelsToFall.Count > 0)
            {
                JewelsFalling = utils.MBehaviour.StartCoroutine(CascadeJewelFromQueue());
            }
            else
            {
                yield return(new WaitForSeconds(.2f));

                CheckEndCascade();
            }
        }
Esempio n. 2
0
 public UIJewelDestroy(IUiJewelComponents Parent)
 {
     Parent.UIRuntimeData.OnSetData += ExecuteData;
     Parent.OnRemove += ExecuteDestroy;
     parent           = Parent;
 }
Esempio n. 3
0
 public UIJewelPosition(IUiJewelComponents Parent)
 {
     Parent.UIRuntimeData.OnSetData += Execute;
     parent    = Parent;
     transform = Parent.transform;
 }
Esempio n. 4
0
 public UIJewelSprite(IUiJewelComponents Parent)
 {
     Parent.UIRuntimeData.OnSetData += Execute;
     SprRend = Parent.Renderer;
     parent  = Parent;
 }
Esempio n. 5
0
 public static void Format(IUiJewelComponents jewelComp, UiJewelParameters param)
 {
     jewelComp.MonoBehavior.transform.localScale *= param.JewelScale;
 }
Esempio n. 6
0
 public UIJewelTransform(IUiJewelComponents parent)
 {
     parent.UIRuntimeData.OnSetData += Execute;
     this.transform = parent.transform;
 }
Esempio n. 7
0
 public UIJewelBoxCollider(IUiJewelComponents parent)
 {
     parent.UIRuntimeData.OnSetData += Execute;
     this.collider = parent.BoxCollider;
 }