コード例 #1
0
    protected override void Start()
    {
        base.Start();
        // Override sorting so the object is in front
        canvas.overrideSorting = true;
        canvas.sortingOrder    = 10;

        // Get the start position
        Vector3 start = MatrixParent.RowUIs[0].ItemUIs[0].transform.position;
        // Get the end position
        MatrixRowUI lastRow = MatrixParent.RowUIs[MatrixParent.RowUIs.Length - 1];
        Vector3     end     = lastRow.ItemUIs[lastRow.ItemUIs.Length - 1].transform.position;

        // Set the positions of the line
        line.SetPoints(start, end);

        // Set the starting scale of the rect transform
        rectTransform.localScale = Vector3.one * startingScale;

        // Set the starting color of the image
        Color transparentColor = new Color(image.color.r, image.color.g, image.color.b, 0f);
        Color targetColor      = image.color;

        image.color = transparentColor;

        // Do scale and color
        rectTransform.DOScale(endingScale, shrinkTime);
        image.DOColor(targetColor, shrinkTime);
    }
コード例 #2
0
    public void Setup(MatrixRowUI rowParent, int columnIndex)
    {
        Start();

        this.rowParent   = rowParent;
        this.columnIndex = columnIndex;

        // Instantiate a preview effect to use when previewing the win state
        if (rowParent.RowIndex == columnIndex)
        {
            currentPreviewEffect = Instantiate(focusPreviewEffect, transform);
            currentPreviewEffect.gameObject.SetActive(false);
        }

        // Add listener for matrix events
        MatrixParent.OnMatrixSolved.AddListener(OnMatrixSolved);
        MatrixParent.OnOperationDestinationUnset.AddListener(OnMatrixOperationDestinationUnset);

        // Get a list of all graphics in the arrow
        arrowGraphics = previewArrow.GetComponentsInChildren <Graphic>(true);

        // Show the current fraction
        ShowCurrent();
    }