Exemple #1
0
    public void LoadState()
    {
        if (stateList.Count != 0)
        {
            var boxCollider = gameObject.GetComponent <BoxCollider>();
            boxCollider.enabled = false;

            transform.position = stateList[stateList.Count - 1].position;
            playerObject.transform.rotation = stateList[stateList.Count - 1].rotation;
            endPos = stateList[stateList.Count - 1].position;

            if (beadCount != stateList[stateList.Count - 1].beadCnt)
            {
                beadCount = stateList[stateList.Count - 1].beadCnt;
                panelScript.CubeController(beadCount);

                for (int i = 0; i < beads.Length; i++)
                {
                    beads[i].SetActive(stateList[stateList.Count - 1].beadActive[i]);
                }
            }

            boxCollider.enabled = true;

            stateList.RemoveAt(stateList.Count - 1);
        }
    }