Пример #1
0
    IEnumerator DoConnectedEnter(State prevState)
    {
        switch (prevState)
        {
        case State.Connecting:
            if (animator && !string.IsNullOrEmpty(takeConnectingExit))
            {
                yield return(animator.PlayWait(takeConnectingExit));
            }

            HideConnectingDisplay();
            break;
        }

        if (bodyConnectedGO)
        {
            bodyConnectedGO.SetActive(true);
        }

        if (animator && !string.IsNullOrEmpty(takeConnectedEnter))
        {
            yield return(animator.PlayWait(takeConnectedEnter));
        }

        if (selectGO)
        {
            selectGO.SetActive(mIsPointerEnter);
        }

        mRout = null;
    }
Пример #2
0
    IEnumerator DoPlayBegin()
    {
        //enter hud
        if (animator && !string.IsNullOrEmpty(takeEnter))
        {
            yield return(animator.PlayWait(takeEnter));
        }

        //wait a bit
        yield return(new WaitForSeconds(beginDelay));

        //ready set go
        if (readySetGoDisplayGO)
        {
            readySetGoDisplayGO.SetActive(true);
        }

        if (animator && !string.IsNullOrEmpty(takeReadySetGo))
        {
            yield return(animator.PlayWait(takeReadySetGo));
        }

        if (readySetGoDisplayGO)
        {
            readySetGoDisplayGO.SetActive(false);
        }

        //play
        signalInvokePlayStart.Invoke();

        SetEquationUpdateActive(true);

        linkDisconnectButton.interactable = true;
    }
Пример #3
0
    IEnumerator DoSpawn()
    {
        M8.SoundPlaylist.instance.Play(soundSpawn, false);

        if (animator && !string.IsNullOrEmpty(takeSpawn))
        {
            yield return(animator.PlayWait(takeSpawn));
        }
        else
        {
            yield return(null);
        }

        mRout = null;

        state = State.Normal;

        //impulse center
        var centerDir = M8.MathUtil.RotateAngle(Vector2.up, Random.Range(0f, 360f));

        jellySprite.CentralPoint.Body2D.AddForce(centerDir * spawnCenterImpulse.random, ForceMode2D.Impulse);

        //impulse edges
        if (jellySprite.ReferencePoints.Count > 1)
        {
            var edgeDir = Vector2.right;
            var rotAmt  = 360f / (jellySprite.ReferencePoints.Count - 1);
            for (int i = 1; i < jellySprite.ReferencePoints.Count; i++)
            {
                var refPt = jellySprite.ReferencePoints[i];
                refPt.Body2D.AddForce(edgeDir * spawnEdgeImpulse.random, ForceMode2D.Impulse);
                edgeDir = M8.MathUtil.RotateAngle(edgeDir, rotAmt);
            }
        }
    }
Пример #4
0
    IEnumerator DoShow()
    {
        nextButtonGO.SetActive(false);
        nextIndicatorGO.SetActive(false);

        prevButtonGO.SetActive(false);

        rootGO.SetActive(true);

        if (animator && !string.IsNullOrEmpty(takeEnter))
        {
            yield return(animator.PlayWait(takeEnter));
        }

        //show prev and/or next
        if (mIsNextShown)
        {
            StartCoroutine(DoShow(nextButtonGO, null, nextEnterExit));
        }

        if (mIsPrevShown)
        {
            StartCoroutine(DoShow(prevButtonGO, null, prevEnterExit));
        }

        mRout = null;
    }
Пример #5
0
    IEnumerator DoShow()
    {
        yield return(null);

        if (animator)
        {
            var takeLast = animator.currentPlayingTakeName;

            while (animator.isPlaying)
            {
                yield return(null);
            }

            if (!string.IsNullOrEmpty(sfxOpen))
            {
                M8.SoundPlaylist.instance.Play(sfxOpen, false);
            }

            if (!string.IsNullOrEmpty(takeEnter) && takeLast != takeEnter)
            {
                yield return(animator.PlayWait(takeEnter));
            }
        }

        mRout = null;
    }
Пример #6
0
    IEnumerator DoPopup()
    {
        var wait = new WaitForSeconds(delay);

        while (mLogQueue.Count > 0)
        {
            var log = mLogQueue.Dequeue();

            timeText.text   = log.GetTimeString();
            detailText.text = M8.Localize.Get(log.detailTextRef);

            if (animator && !string.IsNullOrEmpty(takeEnter))
            {
                yield return(animator.PlayWait(takeEnter));
            }

            yield return(wait);

            if (animator && !string.IsNullOrEmpty(takeExit))
            {
                yield return(animator.PlayWait(takeExit));
            }
        }

        mRout = null;
    }
Пример #7
0
    IEnumerator DoShow()
    {
        if (animator && !string.IsNullOrEmpty(takeShow))
        {
            yield return(animator.PlayWait(takeShow));
        }

        mRout = null;
    }
Пример #8
0
    public IEnumerator Enter()
    {
        if (go)
        {
            go.SetActive(true);
        }

        if (animator && !string.IsNullOrEmpty(takeEnter))
        {
            yield return(animator.PlayWait(takeEnter));
        }
    }
Пример #9
0
    IEnumerator DoExtrusiveProceed()
    {
        ClearSelection();

        yield return(extrusiveSequence.Exit());

        //initialize display

        //change mode
        yield return(DoMode(Mode.Extrusive));

        //explode
        if (extrusiveAnimator && !string.IsNullOrEmpty(extrusiveTakePlay))
        {
            yield return(extrusiveAnimator.PlayWait(extrusiveTakePlay));
        }

        //just shove random rocks into the list
        var magmaCount = inventory.magma.count;

        M8.ArrayUtil.Shuffle(extrusiveRocks);
        mRockResultList.Clear();
        for (int i = 0; i < extrusiveResultCount; i++)
        {
            var rock = extrusiveRocks[i];

            if (GlobalSettings.isUnlimitedResource)
            {
                if (rock.count <= 0)
                {
                    rock.count = GlobalSettings.unlimitedResourceRock;
                }
            }
            else
            {
                rock.count += inventory.igneousOutput;

                magmaCount -= inventory.igneousOutput;
                if (magmaCount < 0)
                {
                    magmaCount = 0;
                }
            }

            mRockResultList.Add(rock);
        }

        inventory.magma.count = magmaCount;
        //

        //show rocks
        StartCoroutine(DoRockResult());
    }
Пример #10
0
    IEnumerator DoComboDisplay()
    {
        ApplyCurrentComboCountDisplay();

        if (comboGO)
        {
            comboGO.SetActive(true);
        }

        if (comboAnimator && !string.IsNullOrEmpty(comboTakeEnter))
        {
            yield return(comboAnimator.PlayWait(comboTakeEnter));
        }

        var comboDuration = GameData.instance.comboDuration;

        var playCtrl = PlayController.instance;

        while (playCtrl.comboIsActive)
        {
            if (mCurComboCountDisplay != playCtrl.comboCount)
            {
                ApplyCurrentComboCountDisplay();

                if (comboAnimator && !string.IsNullOrEmpty(comboTakeUpdate))
                {
                    comboAnimator.Play(comboTakeUpdate);
                }
            }

            if (comboTimeFill)
            {
                comboTimeFill.fillAmount = 1.0f - Mathf.Clamp01(playCtrl.comboCurTime / comboDuration);
            }

            yield return(null);
        }

        if (comboAnimator && !string.IsNullOrEmpty(comboTakeExit))
        {
            yield return(comboAnimator.PlayWait(comboTakeExit));
        }

        //clear combo display
        if (comboGO)
        {
            comboGO.SetActive(false);
        }

        mCurComboCountDisplay = 0;

        mComboDisplayRout = null;
    }
Пример #11
0
    IEnumerator DoCorrectPopUp()
    {
        var wait = new WaitForSeconds(correctEqPopShowDelay);

        while (mCorrectPopUpQueue.Count > 0)
        {
            var dat = mCorrectPopUpQueue.Dequeue();

            //apply display
            if (correctEqPopText)
            {
                correctEqPopText.text = dat.GetString(true);
            }

            //show/update
            if (correctEqPopAnimator)
            {
                if (!correctEqPopAnimator.gameObject.activeSelf)
                {
                    correctEqPopAnimator.gameObject.SetActive(true);

                    if (!string.IsNullOrEmpty(correctEqPopTakeEnter))
                    {
                        yield return(correctEqPopAnimator.PlayWait(correctEqPopTakeEnter));
                    }
                }

                if (!string.IsNullOrEmpty(correctEqPopTakeUpdate))
                {
                    yield return(correctEqPopAnimator.PlayWait(correctEqPopTakeUpdate));
                }
            }

            yield return(wait);

            //hide
            if (mCorrectPopUpQueue.Count == 0)
            {
                if (correctEqPopAnimator)
                {
                    if (!string.IsNullOrEmpty(correctEqPopTakeExit))
                    {
                        yield return(correctEqPopAnimator.PlayWait(correctEqPopTakeExit));
                    }

                    correctEqPopAnimator.gameObject.SetActive(false);
                }
            }
        }

        mCorrectPopUpRout = null;
    }
Пример #12
0
    protected override IEnumerator Start()
    {
        yield return(base.Start());

        //music
        M8.MusicPlaylist.instance.Play(playMusic, true, false);

        //play enter if available
        if (animator && !string.IsNullOrEmpty(takeBegin))
        {
            yield return(animator.PlayWait(takeBegin));
        }
    }
Пример #13
0
    IEnumerator DoShow()
    {
        if (rootGO)
        {
            rootGO.SetActive(true);
        }

        if (animator && !string.IsNullOrEmpty(takeShow))
        {
            yield return(animator.PlayWait(takeShow));
        }

        mRout = null;
    }
Пример #14
0
 public IEnumerator PlayNewlySeen()
 {
     if (animator && !string.IsNullOrEmpty(takeNewlySeen))
     {
         yield return(animator.PlayWait(takeNewlySeen));
     }
 }
Пример #15
0
    IEnumerator DoProcess()
    {
        highlight.enabled = false;

        if (animator && !string.IsNullOrEmpty(takeProcess))
        {
            yield return(animator.PlayWait(takeProcess));
        }

        //apply
        switch (mode)
        {
        case Mode.FractionToWhole:
            target.number.FractionToWholeSingle();
            break;

        case Mode.WholeToFraction:
            target.number.WholeToFractionSingle();
            break;
        }

        target.RefreshDisplay();

        if (!string.IsNullOrEmpty(takeFinish))
        {
            animator.Play(takeFinish);
        }

        mProcessRout = null;

        highlight.enabled = IsValid();
    }
Пример #16
0
    IEnumerator DoWholeToFractionAnimation()
    {
        while (animator.isPlaying)
        {
            yield return(null);
        }

        bool canPulse = CanPulse();

        ApplyWholeDisplay();

        if (canPulse && wholeRootGO)
        {
            StartCoroutine(DoPulse(wholeRootGO.transform));
        }

        //apply aesthetic numbers
        if (mNumberPrev.denominator > 0)
        {
            ApplyFractionFX(mNumberPrev.whole * mNumberPrev.denominator, mNumberPrev.denominator);
        }
        else
        {
            ApplyFractionFX(mNumberPrev.whole, 1);
        }

        if (fractionFXGO)
        {
            fractionFXGO.SetActive(true);
        }

        yield return(animator.PlayWait(takeWholeToFraction));

        if (fractionFXGO)
        {
            fractionFXGO.SetActive(false);
        }

        ApplyFractionDisplay();

        if (canPulse && fractionRootGO)
        {
            StartCoroutine(DoPulse(fractionRootGO.transform));
        }

        mSwapRout = null;
    }
Пример #17
0
    IEnumerator DoEnterInterface()
    {
        if (!mSelectableActive) //fail-safe
        {
            yield break;
        }

        mSelectableActive.interactable = false;

        if (animator && !string.IsNullOrEmpty(takeUIEnter))
        {
            yield return(animator.PlayWait(takeUIEnter));
        }

        mSelectableActive.interactable = true;
        mSelectableActive.Select();
    }
Пример #18
0
    IEnumerator DoEnter()
    {
        displayGO.SetActive(true);

        if (animator)
        {
            if (!string.IsNullOrEmpty(takeEnter))
            {
                yield return(animator.PlayWait(takeEnter));
            }

            if (!string.IsNullOrEmpty(takeIdle))
            {
                animator.Play(takeIdle);
            }
        }

        mRout = null;
    }
Пример #19
0
    IEnumerator DoShow()
    {
        if (activeGO)
        {
            activeGO.SetActive(true);
        }

        if (animator && !string.IsNullOrEmpty(takeEnter))
        {
            yield return(animator.PlayWait(takeEnter));
        }

        //show drag instruct
        if (mDragInstructEnabled)
        {
            DragInstructStart();
        }

        mRout = null;
    }
Пример #20
0
    IEnumerator DoPrev()
    {
        var prevShapeCat = mShapeCategories[mCurShapeCategoryIndex - 1];

        categoryNext.Setup(prevShapeCat);
        categoryNext.transform.position = categoryPrevAnchor.position;
        categoryNext.gameObject.SetActive(true);

        if (animator && !string.IsNullOrEmpty(takeCategoryPrev))
        {
            yield return(animator.PlayWait(takeCategoryPrev));

            animator.ResetTake(takeCategoryPrev);
        }

        mCurShapeCategoryIndex--;

        ApplyCurrent();
        SpeakCurrent();
    }
Пример #21
0
    IEnumerator DoRockListGather(RockData[] rocks)
    {
        Vector2 startPos = mPlayerTrans.position;
        Vector2 endPos   = destination.position;


        for (int i = 0; i < rocks.Length; i++)
        {
            var rock = rocks[i];
            if (!rock.isNewlySeen)
            {
                continue;
            }

            rockSpriteShape.spriteShape = rock.spriteShape;

            mRockTrans.position    = startPos;
            mRockTrans.eulerAngles = new Vector3(0f, 0f, Random.Range(0f, 360f));

            if (!string.IsNullOrEmpty(soundGather))
            {
                M8.SoundPlaylist.instance.Play(soundGather, false);
            }

            yield return(rockAnimator.PlayWait(rockTakeEnter));

            float curTime = 0f;
            while (curTime < rockMoveDelay)
            {
                yield return(null);

                curTime += Time.deltaTime;

                var t = mRockMoveEaseFunc(curTime, rockMoveDelay, 0f, 0f);

                mRockTrans.position = Vector2.Lerp(startPos, endPos, t);
            }

            yield return(rockAnimator.PlayWait(rockTakeExit));
        }
    }
Пример #22
0
    IEnumerator DoPlay()
    {
        if (activeGO)
        {
            activeGO.SetActive(true);
        }

        if (animator && !string.IsNullOrEmpty(takeBegin))
        {
            yield return(animator.PlayWait(takeBegin));
        }

        connectControl.curOp = op.op;

        //spawn operation
        blobSpawner.Spawn(0, op.operand1);
        blobSpawner.Spawn(1 % blobSpawner.templateGroups.Length, op.operand2);
        blobSpawner.Spawn(2 % blobSpawner.templateGroups.Length, op.equal);

        mRout = null;
    }
Пример #23
0
    IEnumerator DoCapture()
    {
        GameData.instance.CaptureScreen(mCamera);

        if (animator && !string.IsNullOrEmpty(takeCapture))
        {
            yield return(animator.PlayWait(takeCapture));
        }

        ApplyCapture();

        mCaptureRout = null;
    }
Пример #24
0
    IEnumerator DoSpawn()
    {
        if (mCameraFollow.follow != transform)
        {
            mCameraFollow.follow = transform;
        }
        else
        {
            mCameraFollow.GotoCurrentFollow();
        }

        while (mCameraFollow.state == CameraFollow.State.Goto)
        {
            yield return(null);
        }

        M8.SoundPlaylist.instance.Play(soundSpawn, false);

        yield return(animator.PlayWait(takeSpawn));

        stateControl.state = stateNormal;
    }
Пример #25
0
    IEnumerator DoIncorrectPopUp()
    {
        var wait = new WaitForSeconds(incorrectEqPopShowDelay);

        //show/update
        if (incorrectEqPopAnimator)
        {
            if (!incorrectEqPopAnimator.gameObject.activeSelf)
            {
                incorrectEqPopAnimator.gameObject.SetActive(true);

                if (!string.IsNullOrEmpty(incorrectEqPopTakeEnter))
                {
                    yield return(incorrectEqPopAnimator.PlayWait(incorrectEqPopTakeEnter));
                }
            }

            if (!string.IsNullOrEmpty(incorrectEqPopTakeUpdate))
            {
                yield return(incorrectEqPopAnimator.PlayWait(incorrectEqPopTakeUpdate));
            }
        }

        yield return(wait);

        //hide
        if (incorrectEqPopAnimator)
        {
            if (!string.IsNullOrEmpty(incorrectEqPopTakeExit))
            {
                yield return(incorrectEqPopAnimator.PlayWait(incorrectEqPopTakeExit));
            }

            incorrectEqPopAnimator.gameObject.SetActive(false);
        }

        mIncorrectPopUpRout = null;
    }
Пример #26
0
    IEnumerator DoEnter()
    {
        if (activeGO)
        {
            activeGO.SetActive(true);
        }

        yield return(animator.PlayWait(takeEnter));

        while (Time.time - mLastTriggerTime < changeDelay)
        {
            yield return(null);
        }

        if (!mIsTriggered)
        {
            mRout = StartCoroutine(DoExit());
        }
        else
        {
            mRout = null;
        }
    }
Пример #27
0
    IEnumerator DoAcquire(DeviceItem item)
    {
        HUD.instance.Hide();

        if (rootGO)
        {
            rootGO.SetActive(true);
        }

        if (item.displayGO)
        {
            item.displayGO.SetActive(true);
        }

        if (animator && !string.IsNullOrEmpty(takeEnter))
        {
            animator.Play(takeEnter);
        }

        //show modal
        mModalParms[AcquisitionModal.parmItems] = item.acquisitionItems;

        M8.ModalManager.main.Open(modalAcquire, mModalParms);

        //wait for modal to close
        while (M8.ModalManager.main.isBusy || M8.ModalManager.main.IsInStack(modalAcquire))
        {
            yield return(null);
        }

        if (animator && !string.IsNullOrEmpty(takeExit))
        {
            yield return(animator.PlayWait(takeExit));
        }

        if (item.displayGO)
        {
            item.displayGO.SetActive(false);
        }

        if (rootGO)
        {
            rootGO.SetActive(false);
        }

        HUD.instance.Show();

        mRout = null;
    }
Пример #28
0
    IEnumerator DoEnter()
    {
        if (animator && !string.IsNullOrEmpty(takeEnter))
        {
            yield return(animator.PlayWait(takeEnter));
        }
        else
        {
            yield return(null);
        }

        mCurRout = null;

        action = Action.Idle;
    }
Пример #29
0
    IEnumerator DoCapture()
    {
        GameData.instance.Capture(mCurCaptureIndex, mCamera);

        if (animator && !string.IsNullOrEmpty(takeCapture))
        {
            yield return(animator.PlayWait(takeCapture));
        }

        ApplyCapture(mCurCaptureIndex);

        mCurCaptureIndex++;
        if (mCurCaptureIndex == GameData.instance.captureCount)
        {
            mCurCaptureIndex = 0;
        }

        mCaptureRout = null;
    }
Пример #30
0
    IEnumerator DoBuild()
    {
        yield return(null);

        var buildRiseEaseFunc = DG.Tweening.Core.Easing.EaseManager.ToEaseFunction(buildRiseEase);

        var editCtrl = GridEditController.instance;
        var gridCtrl = editCtrl.entityContainer.controller;
        var evals    = editCtrl.goalEvaluations;

        var unitSize      = gridCtrl.unitSize;
        var unitSizeHalf  = unitSize * 0.5f;
        var unitSizeQuart = unitSizeHalf * 0.5f;

        Bounds  bounds = new Bounds();
        Vector3 minBound, maxBound;
        int     minRow, minCol, maxRow, maxCol;
        int     rowCount, colCount;
        int     maxHeight;

        for (int i = 0; i < evals.Length; i++)
        {
            var eval = evals[i];

            //initiate info
            minBound  = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
            maxBound  = new Vector3(float.MinValue, float.MinValue, float.MinValue);
            minRow    = minCol = int.MaxValue; maxRow = maxCol = int.MinValue;
            maxHeight = 0;

            for (int j = 0; j < eval.entityEdits.Length; j++)
            {
                var ent = eval.entityEdits[j].entity;

                var entTrans      = ent.transform;
                var entBound      = ent.bounds;
                var entCellInd    = ent.cellIndex;
                var entCellIndEnd = ent.cellEnd;

                var entBoundMin = entTrans.localPosition + entBound.min;
                var entBoundMax = entTrans.localPosition + entBound.max;

                if (entBoundMin.x < minBound.x)
                {
                    minBound.x = entBoundMin.x;
                }
                if (entBoundMin.y < minBound.y)
                {
                    minBound.y = entBoundMin.y;
                }
                if (entBoundMin.z < minBound.z)
                {
                    minBound.z = entBoundMin.z;
                }

                if (entBoundMax.x > maxBound.x)
                {
                    maxBound.x = entBoundMax.x;
                }
                if (entBoundMax.y > maxBound.y)
                {
                    maxBound.y = entBoundMax.y;
                }
                if (entBoundMax.z > maxBound.z)
                {
                    maxBound.z = entBoundMax.z;
                }

                if (entCellInd.row < minRow)
                {
                    minRow = entCellInd.row;
                }
                if (entCellIndEnd.row > maxRow)
                {
                    maxRow = entCellIndEnd.row;
                }

                if (entCellInd.col < minCol)
                {
                    minCol = entCellInd.col;
                }
                if (entCellIndEnd.col > maxCol)
                {
                    maxCol = entCellIndEnd.col;
                }

                if (ent.cellSize.b > maxHeight)
                {
                    maxHeight = ent.cellSize.b;
                }
            }

            bounds.min = minBound;
            bounds.max = maxBound;

            var startY = bounds.min.y - (bounds.size.y + unitSize);
            var endY   = bounds.min.y;

            rowCount = maxRow - minRow + 1;
            colCount = maxCol - minCol + 1;

            ResetHeightMap(rowCount, colCount);

            //populate height map
            for (int j = 0; j < eval.entityEdits.Length; j++)
            {
                var ent = eval.entityEdits[j].entity;

                var entCellInd  = ent.cellIndex;
                var entCellSize = ent.cellSize;

                for (int r = 0; r < entCellSize.row; r++)
                {
                    for (int c = 0; c < entCellSize.col; c++)
                    {
                        mHeightMap[(entCellInd.row - minRow) + r, (entCellInd.col - minCol) + c] = entCellSize.b;
                    }
                }
            }

            //generate container
            var containerGO = new GameObject("build" + i);

            var container = containerGO.transform;
            container.SetParent(root, false);
            container.localPosition = new Vector3(bounds.center.x, startY, bounds.center.z); //start fully submerged

            //construct tiles
            var dat = eval.data;

            for (int r = 0; r < rowCount; r++)
            {
                var pos = new Vector3(-bounds.extents.x + unitSizeHalf, 0f, -bounds.extents.z + r * unitSize + unitSizeHalf);

                for (int c = 0; c < colCount; c++)
                {
                    var height = mHeightMap[r, c];

                    if (height == 1)
                    {
                        GridBuildTileData tile;

                        //determine which template to grab, priority: top, base, bottom
                        if (dat.buildTileTop)
                        {
                            tile = dat.buildTileTop;
                        }
                        else if (dat.buildTileBase)
                        {
                            tile = dat.buildTileBase;
                        }
                        else
                        {
                            tile = dat.buildTileBottom;
                        }

                        if (tile)
                        {
                            GenerateTiles(tile, tile, container, rowCount, colCount, r, c, height, pos, unitSizeQuart);
                        }
                    }
                    else if (height >= 2)
                    {
                        //generate bottom
                        GridBuildTileData bottomTile;
                        if (dat.buildTileBottom)
                        {
                            bottomTile = dat.buildTileBottom;
                        }
                        else if (dat.buildTileBase)
                        {
                            bottomTile = dat.buildTileBase;
                        }
                        else
                        {
                            bottomTile = dat.buildTileTop;
                        }

                        if (bottomTile)
                        {
                            GenerateTiles(bottomTile, dat.buildTileTop, container, rowCount, colCount, r, c, 1, pos, unitSizeQuart);
                        }

                        //generate base
                        GridBuildTileData baseTile;
                        if (dat.buildTileBase)
                        {
                            baseTile = dat.buildTileBase;
                        }
                        else if (dat.buildTileBottom)
                        {
                            baseTile = dat.buildTileBottom;
                        }
                        else
                        {
                            baseTile = dat.buildTileTop;
                        }

                        if (baseTile)
                        {
                            for (int h = 2; h <= height; h++)
                            {
                                GenerateTiles(baseTile, dat.buildTileTop, container, rowCount, colCount, r, c, h, new Vector3(pos.x, pos.y + (h - 1) * unitSize, pos.z), unitSizeQuart);
                            }
                        }
                    }

                    pos.x += unitSize;
                }
            }

            yield return(null);

            var centerBasePos = new Vector3(bounds.center.x, endY, bounds.center.z);

            if (signalInvokeCameraPanTo)
            {
                signalInvokeCameraPanTo.Invoke(centerBasePos);
            }

            //animate crash into
            if (fallAnimator && !string.IsNullOrEmpty(fallTakePlay))
            {
                fallAnimator.transform.position = root.TransformPoint(centerBasePos);

                fallAnimator.gameObject.SetActive(true);

                yield return(fallAnimator.PlayWait(fallTakePlay));

                fallAnimator.gameObject.SetActive(false);
            }

            //build rise
            buildRiseFX.transform.localPosition = centerBasePos;

            //apply shape to fx
            var buildRiseFXShape      = buildRiseFX.shape;
            var buildRiseFXShapeScale = buildRiseFXShape.scale;
            buildRiseFXShapeScale.x = bounds.size.x;
            buildRiseFXShapeScale.z = bounds.size.z;
            buildRiseFXShape.scale  = buildRiseFXShapeScale;

            buildRiseFX.Play();

            if (!string.IsNullOrEmpty(sfxConstruct))
            {
                M8.SoundPlaylist.instance.Play(sfxConstruct, false);
            }

            var curTime = 0f;
            while (curTime < buildRiseDelay)
            {
                yield return(null);

                curTime += Time.deltaTime;

                var t = buildRiseEaseFunc(curTime, buildRiseDelay, 0f, 0f);

                float y = Mathf.Lerp(startY, endY, t);

                container.localPosition = new Vector3(bounds.center.x, y, bounds.center.z);
            }

            buildRiseFX.Stop();
        }


        if (signalInvokeBuildComplete)
        {
            signalInvokeBuildComplete.Invoke();
        }

        editCtrl.editMode = GridEditController.EditMode.BuildComplete;
    }