first commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using ParadoxNotion.Design;
|
||||
using NodeCanvas.Framework;
|
||||
using NodeCanvas.DialogueTrees;
|
||||
using ParadoxNotion;
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Category("Dialogue")]
|
||||
[Description("You can use a variable inline with the text by using brackets likeso: [myVarName] or [Global/myVarName].\nThe bracket will be replaced with the variable value ToString")]
|
||||
[ParadoxNotion.Design.Icon("Dialogue")]
|
||||
public class Say : ActionTask<IDialogueActor>
|
||||
{
|
||||
|
||||
public Statement statement = new Statement("This is a dialogue text...");
|
||||
|
||||
protected override string info {
|
||||
get { return string.Format("<i>' {0} '</i>", ( statement.text.CapLength(30) )); }
|
||||
}
|
||||
|
||||
protected override void OnExecute() {
|
||||
var tempStatement = statement.BlackboardReplace(blackboard);
|
||||
DialogueTree.RequestSubtitles(new SubtitlesRequestInfo(agent, tempStatement, EndAction));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6c54d874c9bbc14e85abb7a9d5b69c8
|
||||
timeCreated: 1428599334
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Actions/Dialogue/Say.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using ParadoxNotion.Design;
|
||||
using NodeCanvas.Framework;
|
||||
using NodeCanvas.DialogueTrees;
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Category("Dialogue")]
|
||||
[ParadoxNotion.Design.Icon("Dialogue")]
|
||||
[Description("A random statement will be chosen each time for the actor to say")]
|
||||
public class SayRandom : ActionTask<IDialogueActor>
|
||||
{
|
||||
|
||||
public List<Statement> statements = new List<Statement>();
|
||||
|
||||
protected override void OnExecute() {
|
||||
var index = Random.Range(0, statements.Count);
|
||||
var statement = statements[index];
|
||||
var tempStatement = statement.BlackboardReplace(blackboard);
|
||||
var info = new SubtitlesRequestInfo(agent, tempStatement, EndAction);
|
||||
DialogueTree.RequestSubtitles(info);
|
||||
}
|
||||
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
///---------------------------------------UNITY EDITOR-------------------------------------------
|
||||
#if UNITY_EDITOR
|
||||
|
||||
protected override void OnTaskInspectorGUI() {
|
||||
var options = new EditorUtils.ReorderableListOptions();
|
||||
options.allowAdd = true;
|
||||
options.allowRemove = true;
|
||||
options.unityObjectContext = ownerSystem.contextObject;
|
||||
EditorUtils.ReorderableList(statements, options, (i, picked) =>
|
||||
{
|
||||
if ( statements[i] == null ) { statements[i] = new Statement("..."); }
|
||||
var statement = statements[i];
|
||||
statement.text = UnityEditor.EditorGUILayout.TextArea(statement.text, (GUIStyle)"textField", GUILayout.Height(50));
|
||||
statement.audio = (AudioClip)UnityEditor.EditorGUILayout.ObjectField("Audio Clip", statement.audio, typeof(AudioClip), false);
|
||||
statement.meta = UnityEditor.EditorGUILayout.TextField("Meta", statement.meta);
|
||||
EditorUtils.Separator();
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df2435e1c53069e4b95d4c92321acc00
|
||||
timeCreated: 1439221607
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Actions/Dialogue/SayRandom.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
using ParadoxNotion.Design;
|
||||
using NodeCanvas.Framework;
|
||||
using NodeCanvas.DialogueTrees;
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Category("Dialogue")]
|
||||
[Description("Starts the Dialogue Tree assigned on a Dialogue Tree Controller object with specified agent used for 'Instigator'.")]
|
||||
[ParadoxNotion.Design.Icon("Dialogue")]
|
||||
public class StartDialogueTree : ActionTask<IDialogueActor>
|
||||
{
|
||||
|
||||
[RequiredField]
|
||||
public BBParameter<DialogueTreeController> dialogueTreeController;
|
||||
public bool waitActionFinish = true;
|
||||
|
||||
public bool isPrefab;
|
||||
|
||||
private DialogueTreeController instance;
|
||||
|
||||
protected override string info {
|
||||
get { return string.Format("Start Dialogue {0}", dialogueTreeController); }
|
||||
}
|
||||
|
||||
protected override void OnExecute() {
|
||||
|
||||
instance = isPrefab ? GameObject.Instantiate(dialogueTreeController.value) : dialogueTreeController.value;
|
||||
|
||||
if ( waitActionFinish ) {
|
||||
instance.StartDialogue(agent, (success) => { if ( isPrefab ) { Object.Destroy(instance.gameObject); } EndAction(success); });
|
||||
} else {
|
||||
instance.StartDialogue(agent, (success) => { if ( isPrefab ) Object.Destroy(instance.gameObject); });
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28ed7b9a98e0807489efa7fac1e773f7
|
||||
timeCreated: 1427326669
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Actions/Dialogue/StartDialogueTree.cs
|
||||
uploadId: 704937
|
||||
Reference in New Issue
Block a user