Created
June 11, 2016 08:45
-
-
Save anonymous/02d64143151ff92691c3201e42ee219a to your computer and use it in GitHub Desktop.
ac save to slot with label
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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