public SlidePuzzleData(SlidePuzzle slidePuzzle)
    {
        invertedCount  = SlidePuzzle.invertedCellCount;
        shiftedCount   = SlidePuzzle.shiftedCellCount;
        isRotateEnable = SlidePuzzle.isRotateEnabled;

        paintIndex = slidePuzzle.GetPaintingIndex();
        pieceCount = slidePuzzle.GetPieceCount();

        GameObject[] cells = slidePuzzle.GetCells();
        randomPozitions  = new float[cells.Length, 2];
        truePozitions    = new float[cells.Length, 2];
        rotations        = new float[cells.Length];
        complexityFactor = slidePuzzle.GetComplexityFactor();

        for (int i = 0; i < cells.Length; i++)
        {
            GameObject cell = cells[i];

            float positionX = cell.GetComponent <RectTransform>().anchoredPosition.x;
            float positionY = cell.GetComponent <RectTransform>().anchoredPosition.y;

            randomPozitions[i, 0] = positionX;
            randomPozitions[i, 1] = positionY;

            float truePositionY = cell.GetComponent <SlideCell>().GetTruePosition().y;
            float truePositionX = cell.GetComponent <SlideCell>().GetTruePosition().x;

            truePozitions[i, 0] = truePositionX;
            truePozitions[i, 1] = truePositionY;

            rotations[i] = cell.transform.rotation.z;
        }
    }
    public static void SaveSlidePuzzle(SlidePuzzle slidePuzzle)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        FileStream      stream    = new FileStream(slidePuzzleSavePath, FileMode.Create);

        SlidePuzzleData data = new SlidePuzzleData(slidePuzzle);

        formatter.Serialize(stream, data);
        stream.Close();
    }
예제 #3
0
    private void LoadPuzzle()
    {
        SlidePuzzleData data = SaveSystem.LoadSlidePuzzle();

        pieceCount      = data.GetPieceCount();
        paintingIndex   = data.GetPaintIndex();
        isRotateEnabled = data.GetIsRotateEnable();
        complexity      = data.GetComplexityFactor();
        slidePuzzle     = new SlidePuzzle(complexity, isRotateEnabled, paintingIndex, selectedCellsSprite, pieceCount, cellsParent, glowShader);
        slidePuzzle.LoadSlidePuzzle(data);
    }
예제 #4
0
    private void BuildPuzzle()
    {
        pieceCount = MainMenuManager.pieceCount;

        paintingIndex = MainMenuManager.paintIndex;

        isRotateEnabled = MainMenuManager.isRotateOn;
        complexity      = MainMenuManager.complexityFactor;
        slidePuzzle     = new SlidePuzzle(complexity, isRotateEnabled, paintingIndex, selectedCellsSprite, pieceCount, cellsParent, glowShader);
        slidePuzzle.BuildSlidePuzzle();
    }
예제 #5
0
 // Use this for initialization
 void Start()
 {
     AM = FindObjectOfType <AudioManager>();
     SP = FindObjectOfType <SlidePuzzle>();
 }