예제 #1
0
    public void SaveSession(string name, Recording recording = null)
    {
        int[] tempSession = Inventory.bowlsManager.activeBowlsIndexes;

        SessionData.Snipt newSession = new SessionData.Snipt {
            name = name
        };

        if (recording != null)
        {
            newSession.recording = new Recording();
            newSession.recording.DeepCopy(recording);
        }

        newSession.bowlsPositions = new int[tempSession.Length];
        newSession.panings        = new float[tempSession.Length];
        newSession.volumes        = new float[tempSession.Length];

        for (int i = 0; i < tempSession.Length; i++)
        {
            // for creating a deep copy of session
            newSession.bowlsPositions[i] = tempSession[i];

            if (newSession.bowlsPositions[i] != -1)
            {
                Debug.Log("Saving: " + Inventory.allBowls[newSession.bowlsPositions[i]].AudioSource.panStereo);
                newSession.panings[i] = Inventory.allBowls[newSession.bowlsPositions[i]].AudioSource.panStereo;
                newSession.volumes[i] = Inventory.allBowls[newSession.bowlsPositions[i]].AudioSource.volume;
            }
        }

        // SessionData.Snipt newSession = new SessionData.Snipt {
        //     name = name,
        //     volumes = volumes,
        //     panings = panings,
        //     bowlsPositions = session,
        //     recording = recording
        // };

        SessionData.AddSession(newSession);
        PersistantData.Save(SessionData);
    }