Skip to content

Instantly share code, notes, and snippets.

Created June 11, 2016 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/02d64143151ff92691c3201e42ee219a to your computer and use it in GitHub Desktop.
Save anonymous/02d64143151ff92691c3201e42ee219a to your computer and use it in GitHub Desktop.
ac save to slot with label
using UnityEngine;
using System.Collections;
using CinemaDirector;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace AC
{
[System.Serializable]
public class ActionSaveProgress : Action
{
// Declare variables here
public int slot;
public string label;
public ActionSaveProgress ()
{
this.isDisplayed = true;
title = "Save : Save Progress";
willWait = true;
}
override public float Run ()
{
if (!isRunning) {
if (slot != 0 && label != "") {
KickStarter.saveSystem.SaveSaveGame (slot, true, label);
} else {
Debug.LogError ("slot or label empty");
}
} else {
isRunning = false;
}
return 0f;
}
#if UNITY_EDITOR
override public void ShowGUI ()
{
// Action-specific Inspector GUI code here
slot = EditorGUILayout.IntField ("Slot:", slot);
label = EditorGUILayout.TextField ("Label:", label);
if (slot == 0 || label == "") {
EditorGUILayout.HelpBox ("Select an object with a director cutscene", MessageType.Warning);
}
willWait = EditorGUILayout.Toggle ("Wait until finish?", willWait);
AfterRunningOption ();
}
public override string SetLabel ()
{
// Return a string used to describe the specific action's job.
return (" (" + slot + " : " + label + ")");
}
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment