예제 #1
0
    private GridRow InitRow(int layer, bool occupy, bool above = false)
    {
        GridRow Row = new GridRow();

        Row.Layer = layer;

        float time = 0f;

        for (int i = 0; i < RowLength; i++)
        {
            var obj    = Instantiate(GridSquarePrefab, transform);
            var oddset = (Mathf.Abs(layer) % 2 == 1)? oddOffset : Vector3.zero;
            //if(above) oddset = (GetLowestLayer -1 % 2 == 1)? oddOffset : Vector3.zero;
            obj.transform.localPosition = startPos + new Vector3(i * MagicSpacing, -layer * MagicSpacing * 0.9f, 0) + oddset;
            var gridSquare = obj.GetComponent <GridSquare>();
            if (occupy)
            {
                gridSquare.RandomOccupy();
                StartCoroutine(myEasing.CoScale(0, 0.5f + time, 0.01f, 1f, gridSquare.transform, Easing.Function.Sinusoidal, Easing.Direction.Out));
            }
            gridSquare.SetLanded(true);
            Row.Row[i] = gridSquare;

            gridSquare.LayerIndex = new Vector2(Row.Layer, i);

            time += 0.05f;
        }
        return(Row);
    }
예제 #2
0
    private void AnimateDummyReload()
    {
        CurrentSquare.transform.localPosition = new Vector3(NextSquarePos.x, NextSquarePos.y, CurrentZ);
        CurrentSquare.transform.localScale    = NextSquare.transform.localScale;

        StartCoroutine(myEasing.CoScale(0, dummyScaleTime, CurrentSquare.transform.localScale.x, 1, CurrentSquare.transform, Easing.Function.Sinusoidal, Easing.Direction.Out));
        StartCoroutine(CoDelayMoveXDummy());
    }
예제 #3
0
    public void OnLevelUp()
    {
        LevelUpPanel.SetActive(true);

        StartCoroutine(myEasing.CoScale(0, AnimationTime, 0.01f, 1f, LevelUpPanel.transform, Easing.Function.Back, Easing.Direction.Out));

        //cycle through all the images to fade them in sine.
        foreach (Image image in LevelUpImages)
        {
            StartCoroutine(myEasing.CoFadeImageAlpha(0, AnimationTime, 0f, 1f, image, Easing.Function.Sinusoidal, Easing.Direction.Out));
        }
        foreach (Text text in LevelUpTexts)
        {
            StartCoroutine(myEasing.CoFadeTextAlpha(0, AnimationTime, 0f, 1f, text, Easing.Function.Sinusoidal, Easing.Direction.Out));
        }

        //pick a random level up message
        //TODO: Make the messages shuffle rather than completely random.
        BannerText.text = WinMessages[Random.Range(0, WinMessages.Count)] + "!";
    }
예제 #4
0
    public void CombineGridSquare(Vector3 position)
    {
        StopAllCoroutines();
        myCollider.enabled = false;
        CanLand            = false;

        EasingActions easing = new EasingActions();

        StartCoroutine(easing.CoMoveY(0, 0.5f, transform.localPosition.y, position.y, transform, Easing.Function.Sinusoidal, Easing.Direction.Out));
        StartCoroutine(easing.CoMoveX(0, 0.5f, transform.localPosition.x, position.x, transform, Easing.Function.Sinusoidal, Easing.Direction.Out));
        StartCoroutine(easing.CoScale(0, 0.5f, 1f, 0.01f, transform, Easing.Function.Sinusoidal, Easing.Direction.Out));
        StartCoroutine(DelayedDestroy(0.5f));
    }