Browse Source

Renamed FungusCommand to Command

master
chrisgregan 11 years ago
parent
commit
62aaaf6011
  1. 2
      Assets/Fungus/Animation/Commands/SetAnimBool.cs
  2. 2
      Assets/Fungus/Animation/Commands/SetAnimFloat.cs
  3. 2
      Assets/Fungus/Animation/Commands/SetAnimInteger.cs
  4. 2
      Assets/Fungus/Animation/Commands/SetAnimTrigger.cs
  5. 4
      Assets/Fungus/Audio/Commands/PlayMusic.cs
  6. 4
      Assets/Fungus/Audio/Commands/PlaySound.cs
  7. 4
      Assets/Fungus/Audio/Commands/SetMusicVolume.cs
  8. 4
      Assets/Fungus/Audio/Commands/StopMusic.cs
  9. 2
      Assets/Fungus/Camera/Commands/FadeToView.cs
  10. 2
      Assets/Fungus/Camera/Commands/MoveToView.cs
  11. 2
      Assets/Fungus/Camera/Commands/ShakeCamera.cs
  12. 2
      Assets/Fungus/Dialog/Commands/AddOption.cs
  13. 2
      Assets/Fungus/Dialog/Commands/Choose.cs
  14. 2
      Assets/Fungus/Dialog/Commands/Say.cs
  15. 2
      Assets/Fungus/Dialog/Commands/SetChooseDialog.cs
  16. 2
      Assets/Fungus/Dialog/Commands/SetSayDialog.cs
  17. 2
      Assets/Fungus/Dialog/Editor/AddOptionEditor.cs
  18. 4
      Assets/Fungus/Dialog/Editor/ChooseEditor.cs
  19. 4
      Assets/Fungus/Dialog/Editor/SayEditor.cs
  20. 4
      Assets/Fungus/Dialog/Editor/SetChooseDialogEditor.cs
  21. 4
      Assets/Fungus/Dialog/Editor/SetSayDialogEditor.cs
  22. 2
      Assets/Fungus/FungusScript/Commands/Call.cs
  23. 4
      Assets/Fungus/FungusScript/Commands/Else.cs
  24. 2
      Assets/Fungus/FungusScript/Commands/EndIf.cs
  25. 4
      Assets/Fungus/FungusScript/Commands/If.cs
  26. 4
      Assets/Fungus/FungusScript/Commands/LoadGlobals.cs
  27. 2
      Assets/Fungus/FungusScript/Commands/LoadScene.cs
  28. 4
      Assets/Fungus/FungusScript/Commands/SaveGlobals.cs
  29. 2
      Assets/Fungus/FungusScript/Commands/SetVariable.cs
  30. 2
      Assets/Fungus/FungusScript/Commands/Wait.cs
  31. 2
      Assets/Fungus/FungusScript/Editor/CallEditor.cs
  32. 16
      Assets/Fungus/FungusScript/Editor/CommandEditor.cs
  33. 2
      Assets/Fungus/FungusScript/Editor/CommandEditor.cs.meta
  34. 26
      Assets/Fungus/FungusScript/Editor/CommandListAdaptor.cs
  35. 2
      Assets/Fungus/FungusScript/Editor/CommandListAdaptor.cs.meta
  36. 2
      Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs
  37. 4
      Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs
  38. 10
      Assets/Fungus/FungusScript/Editor/FungusVariableEditor.cs
  39. 2
      Assets/Fungus/FungusScript/Editor/FungusVariableListAdaptor.cs
  40. 2
      Assets/Fungus/FungusScript/Editor/IfEditor.cs
  41. 14
      Assets/Fungus/FungusScript/Editor/SequenceEditor.cs
  42. 2
      Assets/Fungus/FungusScript/Editor/SetVariableEditor.cs
  43. 4
      Assets/Fungus/FungusScript/Scripts/Command.cs
  44. 0
      Assets/Fungus/FungusScript/Scripts/Command.cs.meta
  45. 6
      Assets/Fungus/FungusScript/Scripts/FungusScript.cs
  46. 16
      Assets/Fungus/FungusScript/Scripts/Sequence.cs
  47. 2
      Assets/Fungus/Sprite/Commands/FadeSprite.cs
  48. 2
      Assets/Fungus/Sprite/Commands/ShowSprite.cs

2
Assets/Fungus/Animation/Commands/SetAnimBool.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Animation", [CommandInfo("Animation",
"Set Anim Bool", "Set Anim Bool",
"Sets a boolean parameter on an animator to control an animation")] "Sets a boolean parameter on an animator to control an animation")]
public class SetAnimBool : FungusCommand public class SetAnimBool : Command
{ {
public Animator animator; public Animator animator;
public string parameterName; public string parameterName;

2
Assets/Fungus/Animation/Commands/SetAnimFloat.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Animation", [CommandInfo("Animation",
"Set Anim Float", "Set Anim Float",
"Sets a float parameter on an animator to control an animation")] "Sets a float parameter on an animator to control an animation")]
public class SetAnimFloat : FungusCommand public class SetAnimFloat : Command
{ {
public Animator animator; public Animator animator;
public string parameterName; public string parameterName;

2
Assets/Fungus/Animation/Commands/SetAnimInteger.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Animation", [CommandInfo("Animation",
"Set Anim Integer", "Set Anim Integer",
"Sets an integer parameter on an animator to control an animation")] "Sets an integer parameter on an animator to control an animation")]
public class SetAnimInteger : FungusCommand public class SetAnimInteger : Command
{ {
public Animator animator; public Animator animator;
public string parameterName; public string parameterName;

2
Assets/Fungus/Animation/Commands/SetAnimTrigger.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Animation", [CommandInfo("Animation",
"Set Anim Trigger", "Set Anim Trigger",
"Sets a trigger parameter on an animator to control an animation")] "Sets a trigger parameter on an animator to control an animation")]
public class SetAnimTrigger : FungusCommand public class SetAnimTrigger : Command
{ {
public Animator animator; public Animator animator;
public string parameterName; public string parameterName;

4
Assets/Fungus/Audio/Commands/PlayMusic.cs

@ -1,4 +1,4 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
namespace Fungus.Script namespace Fungus.Script
@ -6,7 +6,7 @@ namespace Fungus.Script
[CommandInfo("Audio", [CommandInfo("Audio",
"Play Music", "Play Music",
"Plays game music. If any game music is already playing, it is stopped. Music continues playing across scene loads.")] "Plays game music. If any game music is already playing, it is stopped. Music continues playing across scene loads.")]
public class PlayMusic : FungusCommand public class PlayMusic : Command
{ {
public AudioClip musicClip; public AudioClip musicClip;

4
Assets/Fungus/Audio/Commands/PlaySound.cs

@ -1,4 +1,4 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
namespace Fungus.Script namespace Fungus.Script
@ -6,7 +6,7 @@ namespace Fungus.Script
[CommandInfo("Audio", [CommandInfo("Audio",
"Play Sound", "Play Sound",
"Plays a sound effect. Multiple sound effects can play at the same time.")] "Plays a sound effect. Multiple sound effects can play at the same time.")]
public class PlaySound : FungusCommand public class PlaySound : Command
{ {
public AudioClip soundClip; public AudioClip soundClip;

4
Assets/Fungus/Audio/Commands/SetMusicVolume.cs

@ -1,4 +1,4 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
namespace Fungus.Script namespace Fungus.Script
@ -6,7 +6,7 @@ namespace Fungus.Script
[CommandInfo("Audio", [CommandInfo("Audio",
"Set Music Volume", "Set Music Volume",
"Sets the game music volume level.")] "Sets the game music volume level.")]
public class SetMusicVolume : FungusCommand public class SetMusicVolume : Command
{ {
[Range(0,1)] [Range(0,1)]
public float volume = 1; public float volume = 1;

4
Assets/Fungus/Audio/Commands/StopMusic.cs

@ -1,4 +1,4 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
namespace Fungus.Script namespace Fungus.Script
@ -6,7 +6,7 @@ namespace Fungus.Script
[CommandInfo("Audio", [CommandInfo("Audio",
"Stop Music", "Stop Music",
"Stops the currently playing game music.")] "Stops the currently playing game music.")]
public class StopMusic : FungusCommand public class StopMusic : Command
{ {
public override void OnEnter() public override void OnEnter()
{ {

2
Assets/Fungus/Camera/Commands/FadeToView.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Camera", [CommandInfo("Camera",
"Fade To View", "Fade To View",
"Fades the camera out and in again at a location specified by a View object.")] "Fades the camera out and in again at a location specified by a View object.")]
public class FadeToView : FungusCommand public class FadeToView : Command
{ {
public float duration = 1f; public float duration = 1f;
public Fungus.View targetView; public Fungus.View targetView;

2
Assets/Fungus/Camera/Commands/MoveToView.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Camera", [CommandInfo("Camera",
"Move To View", "Move To View",
"Moves the camera to a location specified by a View object.")] "Moves the camera to a location specified by a View object.")]
public class MoveToView : FungusCommand public class MoveToView : Command
{ {
public float duration = 1; public float duration = 1;
public Fungus.View targetView; public Fungus.View targetView;

2
Assets/Fungus/Camera/Commands/ShakeCamera.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Camera", [CommandInfo("Camera",
"Shake Camera", "Shake Camera",
"Applies a camera shake effect to the main camera.")] "Applies a camera shake effect to the main camera.")]
public class ShakeCamera : FungusCommand public class ShakeCamera : Command
{ {
public float duration = 0.5f; public float duration = 0.5f;
public Vector2 amount = new Vector2(1, 1); public Vector2 amount = new Vector2(1, 1);

2
Assets/Fungus/Dialog/Commands/AddOption.cs

@ -8,7 +8,7 @@ namespace Fungus.Script
[CommandInfo("Dialog", [CommandInfo("Dialog",
"Add Option", "Add Option",
"Adds an option for the player to select, displayed by the next Say command.")] "Adds an option for the player to select, displayed by the next Say command.")]
public class AddOption : FungusCommand public class AddOption : Command
{ {
public string optionText; public string optionText;
public Sequence targetSequence; public Sequence targetSequence;

2
Assets/Fungus/Dialog/Commands/Choose.cs

@ -8,7 +8,7 @@ namespace Fungus.Script
[CommandInfo("Dialog", [CommandInfo("Dialog",
"Choose", "Choose",
"Presents a list of options for the player to choose from, with an optional timeout. Add options using preceding AddOption commands.")] "Presents a list of options for the player to choose from, with an optional timeout. Add options using preceding AddOption commands.")]
public class Choose : FungusCommand public class Choose : Command
{ {
public class Option public class Option
{ {

2
Assets/Fungus/Dialog/Commands/Say.cs

@ -8,7 +8,7 @@ namespace Fungus.Script
[CommandInfo("Dialog", [CommandInfo("Dialog",
"Say", "Say",
"Writes a line of story text to the dialog. A list of options can be specified for the player to choose from. Use a non-zero timeout to give the player a limited time to choose.")] "Writes a line of story text to the dialog. A list of options can be specified for the player to choose from. Use a non-zero timeout to give the player a limited time to choose.")]
public class Say : FungusCommand public class Say : Command
{ {
[TextArea(5,10)] [TextArea(5,10)]
public string storyText; public string storyText;

2
Assets/Fungus/Dialog/Commands/SetChooseDialog.cs

@ -8,7 +8,7 @@ namespace Fungus.Script
[CommandInfo("Dialog", [CommandInfo("Dialog",
"Set Choose Dialog", "Set Choose Dialog",
"Sets the active dialog to use for displaying story text with the Choose command.")] "Sets the active dialog to use for displaying story text with the Choose command.")]
public class SetChooseDialog : FungusCommand public class SetChooseDialog : Command
{ {
public ChooseDialog chooseDialog; public ChooseDialog chooseDialog;
static public ChooseDialog activeDialog; static public ChooseDialog activeDialog;

2
Assets/Fungus/Dialog/Commands/SetSayDialog.cs

@ -8,7 +8,7 @@ namespace Fungus.Script
[CommandInfo("Dialog", [CommandInfo("Dialog",
"Set Say Dialog", "Set Say Dialog",
"Sets the active dialog to use for displaying story text with the Say command.")] "Sets the active dialog to use for displaying story text with the Say command.")]
public class SetSayDialog : FungusCommand public class SetSayDialog : Command
{ {
public SayDialog sayDialog; public SayDialog sayDialog;
static public SayDialog activeDialog; static public SayDialog activeDialog;

2
Assets/Fungus/Dialog/Editor/AddOptionEditor.cs

@ -9,7 +9,7 @@ namespace Fungus.Script
{ {
[CustomEditor (typeof(AddOption))] [CustomEditor (typeof(AddOption))]
public class AddOptionEditor : FungusCommandEditor public class AddOptionEditor : CommandEditor
{ {
SerializedProperty optionTextProp; SerializedProperty optionTextProp;
SerializedProperty hideOnSelectedProp; SerializedProperty hideOnSelectedProp;

4
Assets/Fungus/Dialog/Editor/ChooseEditor.cs

@ -9,7 +9,7 @@ namespace Fungus.Script
{ {
[CustomEditor (typeof(Choose))] [CustomEditor (typeof(Choose))]
public class ChooseEditor : FungusCommandEditor public class ChooseEditor : CommandEditor
{ {
static public bool showTagHelp; static public bool showTagHelp;
@ -45,7 +45,7 @@ namespace Fungus.Script
EditorGUILayout.PropertyField(chooseTextProp); EditorGUILayout.PropertyField(chooseTextProp);
FungusCommandEditor.ObjectField<Character>(characterProp, CommandEditor.ObjectField<Character>(characterProp,
new GUIContent("Character", "Character to display in dialog"), new GUIContent("Character", "Character to display in dialog"),
new GUIContent("<None>"), new GUIContent("<None>"),
Character.activeCharacters); Character.activeCharacters);

4
Assets/Fungus/Dialog/Editor/SayEditor.cs

@ -9,7 +9,7 @@ namespace Fungus.Script
{ {
[CustomEditor (typeof(Say))] [CustomEditor (typeof(Say))]
public class SayEditor : FungusCommandEditor public class SayEditor : CommandEditor
{ {
static public bool showTagHelp; static public bool showTagHelp;
@ -85,7 +85,7 @@ namespace Fungus.Script
EditorGUILayout.Separator(); EditorGUILayout.Separator();
FungusCommandEditor.ObjectField<Character>(characterProp, CommandEditor.ObjectField<Character>(characterProp,
new GUIContent("Character", "Character to display in dialog"), new GUIContent("Character", "Character to display in dialog"),
new GUIContent("<None>"), new GUIContent("<None>"),
Character.activeCharacters); Character.activeCharacters);

4
Assets/Fungus/Dialog/Editor/SetChooseDialogEditor.cs

@ -9,7 +9,7 @@ namespace Fungus.Script
{ {
[CustomEditor (typeof(SetChooseDialog))] [CustomEditor (typeof(SetChooseDialog))]
public class SetChooseDialogEditor : FungusCommandEditor public class SetChooseDialogEditor : CommandEditor
{ {
SerializedProperty chooseDialogProp; SerializedProperty chooseDialogProp;
@ -22,7 +22,7 @@ namespace Fungus.Script
{ {
serializedObject.Update(); serializedObject.Update();
FungusCommandEditor.ObjectField<ChooseDialog>(chooseDialogProp, CommandEditor.ObjectField<ChooseDialog>(chooseDialogProp,
new GUIContent("Choose Dialog", "Dialog to use when displaying options with the Choose command."), new GUIContent("Choose Dialog", "Dialog to use when displaying options with the Choose command."),
new GUIContent("<None>"), new GUIContent("<None>"),
ChooseDialog.activeDialogs); ChooseDialog.activeDialogs);

4
Assets/Fungus/Dialog/Editor/SetSayDialogEditor.cs

@ -9,7 +9,7 @@ namespace Fungus.Script
{ {
[CustomEditor (typeof(SetSayDialog))] [CustomEditor (typeof(SetSayDialog))]
public class SetSayDialogEditor : FungusCommandEditor public class SetSayDialogEditor : CommandEditor
{ {
SerializedProperty sayDialogProp; SerializedProperty sayDialogProp;
@ -22,7 +22,7 @@ namespace Fungus.Script
{ {
serializedObject.Update(); serializedObject.Update();
FungusCommandEditor.ObjectField<SayDialog>(sayDialogProp, CommandEditor.ObjectField<SayDialog>(sayDialogProp,
new GUIContent("Say Dialog", "Dialog to use when displaying Say command story text"), new GUIContent("Say Dialog", "Dialog to use when displaying Say command story text"),
new GUIContent("<None>"), new GUIContent("<None>"),
SayDialog.activeDialogs); SayDialog.activeDialogs);

2
Assets/Fungus/FungusScript/Commands/Call.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Call", "Call",
"Execute another sequence.")] "Execute another sequence.")]
public class Call : FungusCommand public class Call : Command
{ {
public Sequence targetSequence; public Sequence targetSequence;

4
Assets/Fungus/FungusScript/Commands/Else.cs

@ -7,14 +7,14 @@ namespace Fungus.Script
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Else", "Else",
"Marks the start of a sequence block to be executed when the preceding If statement is false.")] "Marks the start of a sequence block to be executed when the preceding If statement is false.")]
public class Else : FungusCommand public class Else : Command
{ {
public override void OnEnter() public override void OnEnter()
{ {
// Find the next EndIf command at the same indent level as this Else command // Find the next EndIf command at the same indent level as this Else command
bool foundThisCommand = false; bool foundThisCommand = false;
int indent = indentLevel; int indent = indentLevel;
foreach(FungusCommand command in parentSequence.commandList) foreach(Command command in parentSequence.commandList)
{ {
if (foundThisCommand && if (foundThisCommand &&
command.indentLevel == indent) command.indentLevel == indent)

2
Assets/Fungus/FungusScript/Commands/EndIf.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Scripting", [CommandInfo("Scripting",
"End If", "End If",
"Marks the end of an If statement block.")] "Marks the end of an If statement block.")]
public class EndIf : FungusCommand public class EndIf : Command
{ {
public override void OnEnter() public override void OnEnter()
{ {

4
Assets/Fungus/FungusScript/Commands/If.cs

@ -17,7 +17,7 @@ namespace Fungus.Script
[CommandInfo("Scripting", [CommandInfo("Scripting",
"If", "If",
"If the test expression is true, execute the following block of commands.")] "If the test expression is true, execute the following block of commands.")]
public class If : FungusCommand public class If : Command
{ {
public FungusVariable variable; public FungusVariable variable;
@ -137,7 +137,7 @@ namespace Fungus.Script
// Find the next Else or EndIf command at the same indent level as this If command // Find the next Else or EndIf command at the same indent level as this If command
bool foundThisCommand = false; bool foundThisCommand = false;
int indent = indentLevel; int indent = indentLevel;
foreach(FungusCommand command in parentSequence.commandList) foreach(Command command in parentSequence.commandList)
{ {
if (foundThisCommand && if (foundThisCommand &&
command.indentLevel == indent) command.indentLevel == indent)

4
Assets/Fungus/FungusScript/Commands/LoadGlobals.cs

@ -1,4 +1,4 @@
using UnityEngine; using UnityEngine;
using System; using System;
using System.Collections; using System.Collections;
@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Load Globals", "Load Globals",
"Loads a set of global variables previously saved using the SaveGlobals command.")] "Loads a set of global variables previously saved using the SaveGlobals command.")]
public class LoadGlobals : FungusCommand public class LoadGlobals : Command
{ {
public string saveName = ""; public string saveName = "";

2
Assets/Fungus/FungusScript/Commands/LoadScene.cs

@ -10,7 +10,7 @@ namespace Fungus.Script
"for splitting a large game across multiple scene files to reduce peak memory " + "for splitting a large game across multiple scene files to reduce peak memory " +
"usage. All previously loaded assets (including textures and audio) will be released." + "usage. All previously loaded assets (including textures and audio) will be released." +
"The scene to be loaded must be added to the scene list in Build Settings.")] "The scene to be loaded must be added to the scene list in Build Settings.")]
public class LoadScene : FungusCommand public class LoadScene : Command
{ {
public string sceneName = ""; public string sceneName = "";

4
Assets/Fungus/FungusScript/Commands/SaveGlobals.cs

@ -1,4 +1,4 @@
using UnityEngine; using UnityEngine;
using System; using System;
using System.Collections; using System.Collections;
@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Save Globals", "Save Globals",
"Saves all current global variables to be loaded again later using the LoadGlobals command. This provides a basic save game system.")] "Saves all current global variables to be loaded again later using the LoadGlobals command. This provides a basic save game system.")]
public class SaveGlobals : FungusCommand public class SaveGlobals : Command
{ {
public string saveName = ""; public string saveName = "";

2
Assets/Fungus/FungusScript/Commands/SetVariable.cs

@ -6,7 +6,7 @@ namespace Fungus.Script
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Set Variable", "Set Variable",
"Sets a variable to a new value using simple arithmetic operations. The value can be a constant or another variable.")] "Sets a variable to a new value using simple arithmetic operations. The value can be a constant or another variable.")]
public class SetVariable : FungusCommand public class SetVariable : Command
{ {
public enum SetOperator public enum SetOperator
{ {

2
Assets/Fungus/FungusScript/Commands/Wait.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Wait", "Wait",
"Waits for period of time before executing the next command in the sequence.")] "Waits for period of time before executing the next command in the sequence.")]
public class Wait : FungusCommand public class Wait : Command
{ {
public float duration = 1; public float duration = 1;

2
Assets/Fungus/FungusScript/Editor/CallEditor.cs

@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace Fungus.Script namespace Fungus.Script
{ {
[CustomEditor (typeof(Call))] [CustomEditor (typeof(Call))]
public class CallEditor : FungusCommandEditor public class CallEditor : CommandEditor
{ {
SerializedProperty targetSequenceProp; SerializedProperty targetSequenceProp;

16
Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs → Assets/Fungus/FungusScript/Editor/CommandEditor.cs

@ -7,14 +7,14 @@ using System.Collections.Generic;
namespace Fungus.Script namespace Fungus.Script
{ {
[CustomEditor (typeof(FungusCommand), true)] [CustomEditor (typeof(Command), true)]
public class FungusCommandEditor : Editor public class CommandEditor : Editor
{ {
public static FungusCommand selectedCommand; public static Command selectedCommand;
void OnEnable() void OnEnable()
{ {
FungusCommand t = target as FungusCommand; Command t = target as Command;
if (t != null) if (t != null)
{ {
t.hideFlags = HideFlags.HideInInspector; t.hideFlags = HideFlags.HideInInspector;
@ -38,7 +38,7 @@ namespace Fungus.Script
public virtual void DrawCommandInspectorGUI() public virtual void DrawCommandInspectorGUI()
{ {
FungusCommand t = target as FungusCommand; Command t = target as Command;
if (t == null) if (t == null)
{ {
return; return;
@ -46,7 +46,7 @@ namespace Fungus.Script
FungusScript fungusScript = t.GetFungusScript(); FungusScript fungusScript = t.GetFungusScript();
CommandInfoAttribute commandInfoAttr = FungusCommandEditor.GetCommandInfo(t.GetType()); CommandInfoAttribute commandInfoAttr = CommandEditor.GetCommandInfo(t.GetType());
if (commandInfoAttr == null) if (commandInfoAttr == null)
{ {
return; return;
@ -123,7 +123,7 @@ namespace Fungus.Script
DrawDefaultInspector(); DrawDefaultInspector();
} }
static public FungusCommand PasteCommand(FungusCommand copyCommand, Sequence sequence) static public Command PasteCommand(Command copyCommand, Sequence sequence)
{ {
System.Type type = copyCommand.GetType(); System.Type type = copyCommand.GetType();
Component copy = Undo.AddComponent(sequence.gameObject, type); Component copy = Undo.AddComponent(sequence.gameObject, type);
@ -137,7 +137,7 @@ namespace Fungus.Script
Undo.RecordObject(fungusScript, "Paste Command"); Undo.RecordObject(fungusScript, "Paste Command");
FungusCommand newCommand = copy as FungusCommand; Command newCommand = copy as Command;
sequence.commandList.Add(newCommand); sequence.commandList.Add(newCommand);
return newCommand; return newCommand;

2
Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs.meta → Assets/Fungus/FungusScript/Editor/CommandEditor.cs.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 80223e3961e4449e8a0f1262d71c0cac guid: d0f040e6725a54d70af96df382dd046d
MonoImporter: MonoImporter:
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []

26
Assets/Fungus/FungusScript/Editor/FungusCommandListAdaptor.cs → Assets/Fungus/FungusScript/Editor/CommandListAdaptor.cs

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 Rotorz Limited. All rights reserved. // Copyright (c) 2012-2013 Rotorz Limited. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@ -9,7 +9,7 @@ using Rotorz.ReorderableList;
namespace Fungus.Script namespace Fungus.Script
{ {
public class FungusCommandListAdaptor : IReorderableListAdaptor { public class CommandListAdaptor : IReorderableListAdaptor {
private SerializedProperty _arrayProperty; private SerializedProperty _arrayProperty;
@ -23,7 +23,7 @@ namespace Fungus.Script
get { return _arrayProperty; } get { return _arrayProperty; }
} }
public FungusCommandListAdaptor(SerializedProperty arrayProperty, float fixedItemHeight) { public CommandListAdaptor(SerializedProperty arrayProperty, float fixedItemHeight) {
if (arrayProperty == null) if (arrayProperty == null)
throw new ArgumentNullException("Array property was null."); throw new ArgumentNullException("Array property was null.");
if (!arrayProperty.isArray) if (!arrayProperty.isArray)
@ -33,7 +33,7 @@ namespace Fungus.Script
this.fixedItemHeight = fixedItemHeight; this.fixedItemHeight = fixedItemHeight;
} }
public FungusCommandListAdaptor(SerializedProperty arrayProperty) : this(arrayProperty, 0f) { public CommandListAdaptor(SerializedProperty arrayProperty) : this(arrayProperty, 0f) {
} }
public int Count { public int Count {
@ -49,7 +49,7 @@ namespace Fungus.Script
} }
public void Add() { public void Add() {
FungusCommand newCommand = AddNewCommand(); Command newCommand = AddNewCommand();
if (newCommand == null) if (newCommand == null)
{ {
return; return;
@ -61,7 +61,7 @@ namespace Fungus.Script
} }
public void Insert(int index) { public void Insert(int index) {
FungusCommand newCommand = AddNewCommand(); Command newCommand = AddNewCommand();
if (newCommand == null) if (newCommand == null)
{ {
return; return;
@ -71,7 +71,7 @@ namespace Fungus.Script
_arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = newCommand; _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = newCommand;
} }
FungusCommand AddNewCommand() Command AddNewCommand()
{ {
FungusScript fungusScript = FungusScriptWindow.GetFungusScript(); FungusScript fungusScript = FungusScriptWindow.GetFungusScript();
if (fungusScript == null || if (fungusScript == null ||
@ -86,16 +86,16 @@ namespace Fungus.Script
return null; return null;
} }
return sequence.gameObject.AddComponent(fungusScript.selectedAddCommandType) as FungusCommand; return sequence.gameObject.AddComponent(fungusScript.selectedAddCommandType) as Command;
} }
public void Duplicate(int index) { public void Duplicate(int index) {
FungusCommand command = _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue as FungusCommand; Command command = _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue as Command;
// Add the command as a new component // Add the command as a new component
Sequence parentSequence = command.GetComponent<Sequence>(); Sequence parentSequence = command.GetComponent<Sequence>();
FungusCommand newCommand = FungusCommandEditor.PasteCommand(command, parentSequence); Command newCommand = CommandEditor.PasteCommand(command, parentSequence);
_arrayProperty.InsertArrayElementAtIndex(index); _arrayProperty.InsertArrayElementAtIndex(index);
_arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = newCommand; _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = newCommand;
@ -103,7 +103,7 @@ namespace Fungus.Script
public void Remove(int index) { public void Remove(int index) {
// Remove the Fungus Command component // Remove the Fungus Command component
FungusCommand command = _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue as FungusCommand; Command command = _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue as Command;
Undo.DestroyObjectImmediate(command); Undo.DestroyObjectImmediate(command);
_arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = null; _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = null;
@ -125,9 +125,9 @@ namespace Fungus.Script
public void DrawItem(Rect position, int index) public void DrawItem(Rect position, int index)
{ {
FungusCommand command = this[index].objectReferenceValue as FungusCommand; Command command = this[index].objectReferenceValue as Command;
CommandInfoAttribute commandInfoAttr = FungusCommandEditor.GetCommandInfo(command.GetType()); CommandInfoAttribute commandInfoAttr = CommandEditor.GetCommandInfo(command.GetType());
if (commandInfoAttr == null) if (commandInfoAttr == null)
{ {
return; return;

2
Assets/Fungus/FungusScript/Editor/FungusCommandListAdaptor.cs.meta → Assets/Fungus/FungusScript/Editor/CommandListAdaptor.cs.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 44d3aa3e5c3bf4b99b9899e8d5f5bc52 guid: eb29f5637b3724f518deb1cd70ceb8fd
MonoImporter: MonoImporter:
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []

2
Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs

@ -81,7 +81,7 @@ namespace Fungus.Script
if (t.selectedCommand != null) if (t.selectedCommand != null)
{ {
FungusCommandEditor commandEditor = Editor.CreateEditor(t.selectedCommand) as FungusCommandEditor; CommandEditor commandEditor = Editor.CreateEditor(t.selectedCommand) as CommandEditor;
commandEditor.DrawCommandInspectorGUI(); commandEditor.DrawCommandInspectorGUI();
} }

4
Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs

@ -320,8 +320,8 @@ namespace Fungus.Script
bool sequenceIsSelected = (fungusScript.selectedSequence == sequence); bool sequenceIsSelected = (fungusScript.selectedSequence == sequence);
FungusCommand[] commands = sequence.GetComponentsInChildren<FungusCommand>(); Command[] commands = sequence.GetComponentsInChildren<Command>();
foreach (FungusCommand command in commands) foreach (Command command in commands)
{ {
bool commandIsSelected = (fungusScript.selectedCommand == command); bool commandIsSelected = (fungusScript.selectedCommand == command);

10
Assets/Fungus/FungusScript/Editor/FungusVariableEditor.cs

@ -9,7 +9,7 @@ using System.Linq;
namespace Fungus.Script namespace Fungus.Script
{ {
[CustomEditor (typeof(FungusVariable), true)] [CustomEditor (typeof(FungusVariable), true)]
public class FungusVariableEditor : FungusCommandEditor public class FungusVariableEditor : CommandEditor
{ {
void OnEnable() void OnEnable()
{ {
@ -85,7 +85,7 @@ namespace Fungus.Script
FungusScript fungusScript = property.serializedObject.targetObject as FungusScript; FungusScript fungusScript = property.serializedObject.targetObject as FungusScript;
if (fungusScript == null) if (fungusScript == null)
{ {
FungusCommand command = property.serializedObject.targetObject as FungusCommand; Command command = property.serializedObject.targetObject as Command;
if (command != null) if (command != null)
{ {
fungusScript = command.GetFungusScript(); fungusScript = command.GetFungusScript();
@ -158,7 +158,7 @@ namespace Fungus.Script
FungusScript fungusScript = property.serializedObject.targetObject as FungusScript; FungusScript fungusScript = property.serializedObject.targetObject as FungusScript;
if (fungusScript == null) if (fungusScript == null)
{ {
FungusCommand command = property.serializedObject.targetObject as FungusCommand; Command command = property.serializedObject.targetObject as Command;
if (command != null) if (command != null)
{ {
fungusScript = command.GetFungusScript(); fungusScript = command.GetFungusScript();
@ -231,7 +231,7 @@ namespace Fungus.Script
FungusScript fungusScript = property.serializedObject.targetObject as FungusScript; FungusScript fungusScript = property.serializedObject.targetObject as FungusScript;
if (fungusScript == null) if (fungusScript == null)
{ {
FungusCommand command = property.serializedObject.targetObject as FungusCommand; Command command = property.serializedObject.targetObject as Command;
if (command != null) if (command != null)
{ {
fungusScript = command.GetFungusScript(); fungusScript = command.GetFungusScript();
@ -304,7 +304,7 @@ namespace Fungus.Script
FungusScript fungusScript = property.serializedObject.targetObject as FungusScript; FungusScript fungusScript = property.serializedObject.targetObject as FungusScript;
if (fungusScript == null) if (fungusScript == null)
{ {
FungusCommand command = property.serializedObject.targetObject as FungusCommand; Command command = property.serializedObject.targetObject as Command;
if (command != null) if (command != null)
{ {
fungusScript = command.GetFungusScript(); fungusScript = command.GetFungusScript();

2
Assets/Fungus/FungusScript/Editor/FungusVariableListAdaptor.cs

@ -145,7 +145,7 @@ namespace Fungus.Script
if (fungusScript.selectedSequence != null && if (fungusScript.selectedSequence != null &&
fungusScript.selectedCommand != null) fungusScript.selectedCommand != null)
{ {
foreach (FungusCommand command in fungusScript.selectedSequence.commandList) foreach (Command command in fungusScript.selectedSequence.commandList)
{ {
if (fungusScript.selectedCommand == command && if (fungusScript.selectedCommand == command &&
command.HasReference(variable)) command.HasReference(variable))

2
Assets/Fungus/FungusScript/Editor/IfEditor.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
{ {
[CustomEditor (typeof(If))] [CustomEditor (typeof(If))]
public class IfEditor : FungusCommandEditor public class IfEditor : CommandEditor
{ {
SerializedProperty variableProp; SerializedProperty variableProp;
SerializedProperty compareOperatorProp; SerializedProperty compareOperatorProp;

14
Assets/Fungus/FungusScript/Editor/SequenceEditor.cs

@ -1,4 +1,4 @@
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using System; using System;
using System.Collections; using System.Collections;
@ -41,7 +41,7 @@ namespace Fungus.Script
ReorderableListGUI.Title("Command Sequence"); ReorderableListGUI.Title("Command Sequence");
SerializedProperty commandListProperty = serializedObject.FindProperty("commandList"); SerializedProperty commandListProperty = serializedObject.FindProperty("commandList");
FungusCommandListAdaptor adaptor = new FungusCommandListAdaptor(commandListProperty, 0); CommandListAdaptor adaptor = new CommandListAdaptor(commandListProperty, 0);
ReorderableListControl.DrawControlFromState(adaptor, null, 0); ReorderableListControl.DrawControlFromState(adaptor, null, 0);
if (Application.isPlaying) if (Application.isPlaying)
@ -56,7 +56,7 @@ namespace Fungus.Script
// Build list of categories // Build list of categories
List<string> categories = new List<string>(); List<string> categories = new List<string>();
List<System.Type> subTypes = EditorExtensions.FindDerivedTypes(typeof(FungusCommand)).ToList(); List<System.Type> subTypes = EditorExtensions.FindDerivedTypes(typeof(Command)).ToList();
foreach(System.Type type in subTypes) foreach(System.Type type in subTypes)
{ {
object[] attributes = type.GetCustomAttributes(false); object[] attributes = type.GetCustomAttributes(false);
@ -86,7 +86,7 @@ namespace Fungus.Script
string categoryName = categories[selectedCategoryIndex]; string categoryName = categories[selectedCategoryIndex];
foreach (System.Type type in subTypes) foreach (System.Type type in subTypes)
{ {
CommandInfoAttribute commandInfoAttr = FungusCommandEditor.GetCommandInfo(type); CommandInfoAttribute commandInfoAttr = CommandEditor.GetCommandInfo(type);
if (commandInfoAttr == null) if (commandInfoAttr == null)
{ {
continue; continue;
@ -138,13 +138,13 @@ namespace Fungus.Script
{ {
if (GUILayout.Button("Paste")) if (GUILayout.Button("Paste"))
{ {
fungusScript.selectedCommand = FungusCommandEditor.PasteCommand(fungusScript.copyCommand, fungusScript.selectedSequence); fungusScript.selectedCommand = CommandEditor.PasteCommand(fungusScript.copyCommand, fungusScript.selectedSequence);
} }
} }
EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal();
CommandInfoAttribute infoAttr = FungusCommandEditor.GetCommandInfo(selectedType); CommandInfoAttribute infoAttr = CommandEditor.GetCommandInfo(selectedType);
if (infoAttr != null) if (infoAttr != null)
{ {
GUIStyle labelStyle = new GUIStyle(EditorStyles.miniLabel); GUIStyle labelStyle = new GUIStyle(EditorStyles.miniLabel);
@ -158,7 +158,7 @@ namespace Fungus.Script
void UpdateIndentLevels(Sequence sequence) void UpdateIndentLevels(Sequence sequence)
{ {
int indentLevel = 0; int indentLevel = 0;
foreach(FungusCommand command in sequence.commandList) foreach(Command command in sequence.commandList)
{ {
indentLevel += command.GetPreIndent(); indentLevel += command.GetPreIndent();
command.indentLevel = Math.Max(indentLevel, 0); command.indentLevel = Math.Max(indentLevel, 0);

2
Assets/Fungus/FungusScript/Editor/SetVariableEditor.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
{ {
[CustomEditor (typeof(SetVariable))] [CustomEditor (typeof(SetVariable))]
public class SetVariableEditor : FungusCommandEditor public class SetVariableEditor : CommandEditor
{ {
SerializedProperty variableProp; SerializedProperty variableProp;
SerializedProperty setOperatorProp; SerializedProperty setOperatorProp;

4
Assets/Fungus/FungusScript/Scripts/FungusCommand.cs → Assets/Fungus/FungusScript/Scripts/Command.cs

@ -24,7 +24,7 @@ namespace Fungus.Script
} }
[RequireComponent(typeof(Sequence))] [RequireComponent(typeof(Sequence))]
public class FungusCommand : MonoBehaviour public class Command : MonoBehaviour
{ {
[HideInInspector] [HideInInspector]
public string errorMessage = ""; public string errorMessage = "";
@ -81,7 +81,7 @@ namespace Fungus.Script
Continue(this); Continue(this);
} }
public virtual void Continue(FungusCommand currentCommand) public virtual void Continue(Command currentCommand)
{ {
OnExit(); OnExit();
parentSequence.ExecuteNextCommand(currentCommand); parentSequence.ExecuteNextCommand(currentCommand);

0
Assets/Fungus/FungusScript/Scripts/FungusCommand.cs.meta → Assets/Fungus/FungusScript/Scripts/Command.cs.meta

6
Assets/Fungus/FungusScript/Scripts/FungusScript.cs

@ -1,4 +1,4 @@
using UnityEngine; using UnityEngine;
using System; using System;
using System.Linq; using System.Linq;
using System.Collections; using System.Collections;
@ -13,7 +13,7 @@ namespace Fungus.Script
public Sequence executingSequence; public Sequence executingSequence;
[System.NonSerialized] [System.NonSerialized]
public FungusCommand copyCommand; public Command copyCommand;
[HideInInspector] [HideInInspector]
public int selectedAddCommandIndex; public int selectedAddCommandIndex;
@ -39,7 +39,7 @@ namespace Fungus.Script
public Sequence selectedSequence; public Sequence selectedSequence;
public FungusCommand selectedCommand; public Command selectedCommand;
public bool startAutomatically = true; public bool startAutomatically = true;

16
Assets/Fungus/FungusScript/Scripts/Sequence.cs

@ -25,9 +25,9 @@ namespace Fungus.Script
public FungusScript fungusScript; public FungusScript fungusScript;
[System.NonSerialized] [System.NonSerialized]
public FungusCommand activeCommand; public Command activeCommand;
public List<FungusCommand> commandList = new List<FungusCommand>(); public List<Command> commandList = new List<Command>();
int executionCount; int executionCount;
@ -54,7 +54,7 @@ namespace Fungus.Script
public bool HasError() public bool HasError()
{ {
foreach (FungusCommand command in commandList) foreach (Command command in commandList)
{ {
if (command.errorMessage.Length > 0) if (command.errorMessage.Length > 0)
{ {
@ -81,7 +81,7 @@ namespace Fungus.Script
return executionCount; return executionCount;
} }
public void ExecuteNextCommand(FungusCommand currentCommand = null) public void ExecuteNextCommand(Command currentCommand = null)
{ {
if (currentCommand == null) if (currentCommand == null)
{ {
@ -89,10 +89,10 @@ namespace Fungus.Script
} }
activeCommand = null; activeCommand = null;
FungusCommand nextCommand = null; Command nextCommand = null;
bool executeNext = (currentCommand == null); bool executeNext = (currentCommand == null);
foreach (FungusCommand command in commandList) foreach (Command command in commandList)
{ {
if (command == currentCommand) if (command == currentCommand)
{ {
@ -127,7 +127,7 @@ namespace Fungus.Script
} }
IEnumerator ExecuteAfterDelay(FungusCommand command, float delay) IEnumerator ExecuteAfterDelay(Command command, float delay)
{ {
activeCommand = command; activeCommand = command;
yield return new WaitForSeconds(delay); yield return new WaitForSeconds(delay);
@ -145,7 +145,7 @@ namespace Fungus.Script
public List<Sequence> GetConnectedSequences() public List<Sequence> GetConnectedSequences()
{ {
List<Sequence> connectedSequences = new List<Sequence>(); List<Sequence> connectedSequences = new List<Sequence>();
foreach (FungusCommand command in commandList) foreach (Command command in commandList)
{ {
command.GetConnectedSequences(ref connectedSequences); command.GetConnectedSequences(ref connectedSequences);
} }

2
Assets/Fungus/Sprite/Commands/FadeSprite.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Fade Sprite", "Fade Sprite",
"Fades a sprite to a target color over a period of time.")] "Fades a sprite to a target color over a period of time.")]
public class FadeSprite : FungusCommand public class FadeSprite : Command
{ {
public SpriteRenderer spriteRenderer; public SpriteRenderer spriteRenderer;
public float duration = 1f; public float duration = 1f;

2
Assets/Fungus/Sprite/Commands/ShowSprite.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Show Sprite", "Show Sprite",
"Makes a sprite visible / invisible by setting the color alpha.")] "Makes a sprite visible / invisible by setting the color alpha.")]
public class ShowSprite : FungusCommand public class ShowSprite : Command
{ {
public SpriteRenderer spriteRenderer; public SpriteRenderer spriteRenderer;
public bool visible = true; public bool visible = true;

Loading…
Cancel
Save