예제 #1
0
    /// <summary>
    /// Attempts to save the current creature. Shows an error screen if something went wrong.
    /// </summary>
    /// <param name="name">Name.</param>
    public void SaveCreature(string name)
    {
        saveDialog.ResetErrors();

        if (name == "")
        {
            saveDialog.ShowErrorMessage("The Creature name is empty.");
            return;
        }

        try {
            CreatureSaver.WriteSaveFile(name, joints, bones, muscles);
        } catch (IllegalFilenameException e) {
            saveDialog.ShowErrorMessage("The name can't contain . (dots) or _ (underscores).");
            print(e.Message);
            return;
        }

        // The save was successful
        saveDialog.gameObject.SetActive(false);

        buttonManager.Refresh();
    }