Ejemplo n.º 1
0
    private IEnumerator NewShapeEffectCorutine(ShapeScriptable _newShape)
    {
        float animDur           = 0.03f;
        int   currentShapeIndex = ShapeController.GetCurrentShapeIndex();

        readInput = false;
        Direction randomDir = UnityEngine.Random.Range(0, 2) == 0 ? Direction.Right : Direction.Left;

        for (int i = 0; i < 15; i++)
        {
            gameplayPanel.UpdateShape(randomDir, ShapeController.GetShapeByIndex(currentShapeIndex), ShapeController.GetShapeByIndex(currentShapeIndex - 1), ShapeController.GetShapeByIndex(currentShapeIndex + 1), true, animDur);
            currentShapeIndex++;

            if (randomDir == Direction.Right)
            {
                SwipeController.RightSwipe();
            }
            else
            {
                SwipeController.LeftSwipe();
            }

            yield return(new WaitForSeconds(animDur));
        }

        shapeCtrl.ChangeShape(_newShape);
        readInput = true;
    }
Ejemplo n.º 2
0
    public override void Tick()
    {
        if (!startState)
        {
            return;
        }

        if (changeShapeDelayTimer > 0)
        {
            changeShapeDelayTimer -= Time.deltaTime;
            return;
        }

        if ((readInput || isTutorial) && SwipeController.IsSwiping(Direction.Right))
        {
            SwipeController.RightSwipe();
            shapeCtrl.ChangeShape(Direction.Right, true);
            changeShapeDelayTimer = changeShapeDelayTime;

            if (isTutorial)
            {
                EndTutorial();
            }
        }
        else if ((readInput || isTutorial) && SwipeController.IsSwiping(Direction.Left))
        {
            SwipeController.LeftSwipe();
            shapeCtrl.ChangeShape(Direction.Left, true);
            changeShapeDelayTimer = changeShapeDelayTime;

            if (isTutorial)
            {
                EndTutorial();
            }
        }
    }