Example #1
0
    public virtual LevelCompletionData LoadObjData()
    {
        string path = Application.persistentDataPath + "/" + uniqueId;

        if (!Toolbox.Instance.allIds.Contains(this))
        {
            Toolbox.Instance.allIds.Add(this);
        }

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);

            LevelCompletionData data = formatter.Deserialize(stream) as LevelCompletionData;
            stream.Close();
            return(data);
        }

        else
        {
            Debug.LogError("Platform file not found in " + path);
            return(null);
        }
    }
Example #2
0
 public void ObjSetup(LevelCompletionData objectData)
 {
     if (objectData != null && objectData.completed)
     {
         GetComponent <PuzzleCompletion>().innerRing.gameObject.SetActive(false);
         GetComponent <Renderer>().enabled = false;
     }
 }
Example #3
0
    public override void Awake()
    {
        platform = GetComponent <PuzzleCompletion>();

        if (Application.isPlaying)
        {
            // Debug.Log("platform ID: " + uniqueId);
            LevelCompletionData data = LoadObjData();
            ObjSetup(data);
        }
    }
    protected override void Start()
    {
        base.Start();

        // When operation finishes then update the current move text
        MatrixParent.OnMovesIncreased.AddListener(OnMovesIncreased);

        // Use the current level completion data to determine how to display the fewest moves that the player has solved the puzzle in
        LevelCompletionData completionData = GameplayManager.CurrentLevelCompletionData;

        fewestMovesText.text = "Fewest Moves: " + completionData.FewestMovesString;
    }
Example #5
0
    public override void SaveObj()
    {
        // Debug.Log("saving platform to " + uniqueId);

        BinaryFormatter formatter = new BinaryFormatter();

        Debug.Log(uniqueId);
        string     path   = Application.persistentDataPath + "/" + uniqueId;
        FileStream stream = new FileStream(path, FileMode.Create);

        LevelCompletionData data = new LevelCompletionData(platform);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Example #6
0
    protected override void Start()
    {
        base.Start();

        // Disable the root
        uiRoot.SetActive(false);

        // Disable all of the items that are revealed at the end
        panel.enabled        = false;
        panel.color          = Color.clear;
        congratsText.enabled = false;
        movesText.textRoot.gameObject.SetActive(false);
        fewestMovesText.textRoot.gameObject.SetActive(false);
        highScoreCongratsObject.SetActive(false);
        mainMenuButton.SetActive(false);
        advanceButton.SetActive(false);
        replayButton.SetActive(false);

        // Create a copy of the current level completion data at the start
        completionDataOnPuzzleStart = new LevelCompletionData(GameplayManager.CurrentLevelCompletionData);

        // When the matrix is solved then start the routine
        MatrixParent.OnMatrixSolved.AddListener(() => StartCoroutine(MatrixSolvedUIRoutine()));
    }
Example #7
0
 public LevelCompletionData(LevelCompletionData other) : this(other.completed, other.fewestMoves)
 {
 }