Browse Source

Added #region Public members to all non-editor classes

master
Christopher 8 years ago
parent
commit
0effd7e7f3
  1. 4
      Assets/Fungus/Scripts/Commands/Break.cs
  2. 4
      Assets/Fungus/Scripts/Commands/Call.cs
  3. 14
      Assets/Fungus/Scripts/Commands/CallMethod.cs
  4. 4
      Assets/Fungus/Scripts/Commands/ClearMenu.cs
  5. 4
      Assets/Fungus/Scripts/Commands/Comment.cs
  6. 4
      Assets/Fungus/Scripts/Commands/Condition.cs
  7. 102
      Assets/Fungus/Scripts/Commands/ControlAudio.cs
  8. 116
      Assets/Fungus/Scripts/Commands/ControlStage.cs
  9. 10
      Assets/Fungus/Scripts/Commands/ControlWithDisplay.cs
  10. 14
      Assets/Fungus/Scripts/Commands/Conversation.cs
  11. 4
      Assets/Fungus/Scripts/Commands/DebugLog.cs
  12. 4
      Assets/Fungus/Scripts/Commands/DeleteSaveKey.cs
  13. 4
      Assets/Fungus/Scripts/Commands/Destroy.cs
  14. 4
      Assets/Fungus/Scripts/Commands/Else.cs
  15. 4
      Assets/Fungus/Scripts/Commands/ElseIf.cs
  16. 4
      Assets/Fungus/Scripts/Commands/End.cs
  17. 50
      Assets/Fungus/Scripts/Commands/ExecuteLua.cs
  18. 4
      Assets/Fungus/Scripts/Commands/FadeScreen.cs
  19. 12
      Assets/Fungus/Scripts/Commands/FadeSprite.cs
  20. 18
      Assets/Fungus/Scripts/Commands/FadeToView.cs
  21. 4
      Assets/Fungus/Scripts/Commands/FadeUI.cs
  22. 4
      Assets/Fungus/Scripts/Commands/Fullscreen.cs
  23. 8
      Assets/Fungus/Scripts/Commands/GetText.cs
  24. 96
      Assets/Fungus/Scripts/Commands/If.cs
  25. 63
      Assets/Fungus/Scripts/Commands/InvokeEvent.cs
  26. 129
      Assets/Fungus/Scripts/Commands/InvokeMethod.cs
  27. 4
      Assets/Fungus/Scripts/Commands/Jump.cs
  28. 8
      Assets/Fungus/Scripts/Commands/Label.cs
  29. 4
      Assets/Fungus/Scripts/Commands/LoadScene.cs
  30. 6
      Assets/Fungus/Scripts/Commands/LoadVariable.cs
  31. 4
      Assets/Fungus/Scripts/Commands/LookFrom.cs
  32. 4
      Assets/Fungus/Scripts/Commands/LookTo.cs
  33. 4
      Assets/Fungus/Scripts/Commands/Menu.cs
  34. 4
      Assets/Fungus/Scripts/Commands/MenuTimer.cs
  35. 4
      Assets/Fungus/Scripts/Commands/MoveAdd.cs
  36. 4
      Assets/Fungus/Scripts/Commands/MoveFrom.cs
  37. 4
      Assets/Fungus/Scripts/Commands/MoveTo.cs
  38. 4
      Assets/Fungus/Scripts/Commands/MoveToView.cs
  39. 4
      Assets/Fungus/Scripts/Commands/OpenURL.cs
  40. 4
      Assets/Fungus/Scripts/Commands/PlayAnimState.cs
  41. 4
      Assets/Fungus/Scripts/Commands/PlayMusic.cs
  42. 14
      Assets/Fungus/Scripts/Commands/PlaySound.cs
  43. 18
      Assets/Fungus/Scripts/Commands/PlayUsfxrSound.cs
  44. 70
      Assets/Fungus/Scripts/Commands/Portrait.cs
  45. 4
      Assets/Fungus/Scripts/Commands/PunchPosition.cs
  46. 4
      Assets/Fungus/Scripts/Commands/PunchRotation.cs
  47. 4
      Assets/Fungus/Scripts/Commands/PunchScale.cs
  48. 4
      Assets/Fungus/Scripts/Commands/Quit.cs
  49. 4
      Assets/Fungus/Scripts/Commands/RandomFloat.cs
  50. 4
      Assets/Fungus/Scripts/Commands/RandomInteger.cs
  51. 4
      Assets/Fungus/Scripts/Commands/ReadTextFile.cs
  52. 4
      Assets/Fungus/Scripts/Commands/Reset.cs
  53. 4
      Assets/Fungus/Scripts/Commands/ResetAnimTrigger.cs
  54. 4
      Assets/Fungus/Scripts/Commands/RotateAdd.cs
  55. 4
      Assets/Fungus/Scripts/Commands/RotateFrom.cs
  56. 4
      Assets/Fungus/Scripts/Commands/RotateTo.cs
  57. 6
      Assets/Fungus/Scripts/Commands/SaveVariable.cs
  58. 22
      Assets/Fungus/Scripts/Commands/Say.cs
  59. 4
      Assets/Fungus/Scripts/Commands/ScaleAdd.cs
  60. 4
      Assets/Fungus/Scripts/Commands/ScaleFrom.cs
  61. 4
      Assets/Fungus/Scripts/Commands/ScaleTo.cs
  62. 4
      Assets/Fungus/Scripts/Commands/SendMessage.cs
  63. 4
      Assets/Fungus/Scripts/Commands/SetActive.cs
  64. 4
      Assets/Fungus/Scripts/Commands/SetAnimBool.cs
  65. 4
      Assets/Fungus/Scripts/Commands/SetAnimFloat.cs
  66. 4
      Assets/Fungus/Scripts/Commands/SetAnimInteger.cs
  67. 4
      Assets/Fungus/Scripts/Commands/SetAnimTrigger.cs
  68. 4
      Assets/Fungus/Scripts/Commands/SetAudioPitch.cs
  69. 4
      Assets/Fungus/Scripts/Commands/SetAudioVolume.cs
  70. 4
      Assets/Fungus/Scripts/Commands/SetClickable2D.cs
  71. 40
      Assets/Fungus/Scripts/Commands/SetCollider.cs
  72. 4
      Assets/Fungus/Scripts/Commands/SetDraggable2D.cs
  73. 4
      Assets/Fungus/Scripts/Commands/SetInteractable.cs
  74. 4
      Assets/Fungus/Scripts/Commands/SetLanguage.cs
  75. 32
      Assets/Fungus/Scripts/Commands/SetLayerOrder.cs
  76. 4
      Assets/Fungus/Scripts/Commands/SetMenuDialog.cs
  77. 4
      Assets/Fungus/Scripts/Commands/SetMouseCursor.cs
  78. 10
      Assets/Fungus/Scripts/Commands/SetSaveProfile.cs
  79. 4
      Assets/Fungus/Scripts/Commands/SetSayDialog.cs
  80. 4
      Assets/Fungus/Scripts/Commands/SetSliderValue.cs
  81. 4
      Assets/Fungus/Scripts/Commands/SetSpriteOrder.cs
  82. 30
      Assets/Fungus/Scripts/Commands/SetText.cs
  83. 184
      Assets/Fungus/Scripts/Commands/SetVariable.cs
  84. 28
      Assets/Fungus/Scripts/Commands/ShakeCamera.cs
  85. 4
      Assets/Fungus/Scripts/Commands/ShakePosition.cs
  86. 4
      Assets/Fungus/Scripts/Commands/ShakeRotation.cs
  87. 4
      Assets/Fungus/Scripts/Commands/ShakeScale.cs
  88. 18
      Assets/Fungus/Scripts/Commands/ShowSprite.cs
  89. 4
      Assets/Fungus/Scripts/Commands/SpawnObject.cs
  90. 4
      Assets/Fungus/Scripts/Commands/StartSwipe.cs
  91. 4
      Assets/Fungus/Scripts/Commands/Stop.cs
  92. 4
      Assets/Fungus/Scripts/Commands/StopBlock.cs
  93. 4
      Assets/Fungus/Scripts/Commands/StopFlowchart.cs
  94. 4
      Assets/Fungus/Scripts/Commands/StopMusic.cs
  95. 4
      Assets/Fungus/Scripts/Commands/StopSwipe.cs
  96. 4
      Assets/Fungus/Scripts/Commands/StopTween.cs
  97. 4
      Assets/Fungus/Scripts/Commands/StopTweens.cs
  98. 46
      Assets/Fungus/Scripts/Commands/TweenUI.cs
  99. 12
      Assets/Fungus/Scripts/Commands/Wait.cs
  100. 4
      Assets/Fungus/Scripts/Commands/While.cs
  101. Some files were not shown because too many files have changed in this diff Show More

4
Assets/Fungus/Scripts/Commands/Break.cs

@ -14,6 +14,8 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class Break : Command
{
#region Public members
public override void OnEnter()
{
// Find index of previous while command
@ -67,5 +69,7 @@ namespace Fungus.Commands
{
return new Color32(253, 253, 150, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/Call.cs

@ -44,6 +44,8 @@ namespace Fungus.Commands
[Tooltip("Select if the calling block should stop or continue executing commands, or wait until the called block finishes.")]
[SerializeField] protected CallMode callMode;
#region Public members
public override void OnEnter()
{
var flowchart = GetFlowchart();
@ -138,5 +140,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

14
Assets/Fungus/Scripts/Commands/CallMethod.cs

@ -25,6 +25,13 @@ namespace Fungus.Commands
[Tooltip("Delay (in seconds) before the method will be called")]
[SerializeField] protected float delay;
protected virtual void CallTheMethod()
{
targetObject.SendMessage(methodName, SendMessageOptions.DontRequireReceiver);
}
#region Public members
public override void OnEnter()
{
if (targetObject == null ||
@ -46,11 +53,6 @@ namespace Fungus.Commands
Continue();
}
protected virtual void CallTheMethod()
{
targetObject.SendMessage(methodName, SendMessageOptions.DontRequireReceiver);
}
public override string GetSummary()
{
if (targetObject == null)
@ -70,5 +72,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/ClearMenu.cs

@ -16,6 +16,8 @@ namespace Fungus.Commands
[Tooltip("Menu Dialog to clear the options on")]
[SerializeField] protected MenuDialog menuDialog;
#region Public members
public override void OnEnter()
{
menuDialog.Clear();
@ -37,5 +39,7 @@ namespace Fungus.Commands
{
return new Color32(184, 210, 235, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/Comment.cs

@ -21,6 +21,8 @@ namespace Fungus.Commands
[TextArea(2,4)]
[SerializeField] protected string commentText = "";
#region Public members
public override void OnEnter()
{
Continue();
@ -39,5 +41,7 @@ namespace Fungus.Commands
{
return new Color32(220, 220, 220, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/Condition.cs

@ -11,6 +11,8 @@ namespace Fungus.Commands
[Tooltip("The type of comparison to be performed")]
[SerializeField] protected CompareOperator compareOperator;
#region Public members
public static string GetOperatorDescription(CompareOperator compareOperator)
{
string summary = "";
@ -38,5 +40,7 @@ namespace Fungus.Commands
return summary;
}
#endregion
}
}

102
Assets/Fungus/Scripts/Commands/ControlAudio.cs

@ -55,48 +55,9 @@ namespace Fungus.Commands
[Tooltip("Wait until this command has finished before executing the next command.")]
[SerializeField] protected bool waitUntilFinished = false;
public override void OnEnter()
{
if (_audioSource.Value == null)
{
Continue();
return;
}
if (control != ControlAudioType.ChangeVolume)
{
_audioSource.Value.volume = endVolume;
}
switch(control)
{
case ControlAudioType.PlayOnce:
StopAudioWithSameTag();
PlayOnce();
break;
case ControlAudioType.PlayLoop:
StopAudioWithSameTag();
PlayLoop();
break;
case ControlAudioType.PauseLoop:
PauseLoop();
break;
case ControlAudioType.StopLoop:
StopLoop(_audioSource.Value);
break;
case ControlAudioType.ChangeVolume:
ChangeVolume();
break;
}
if (!waitUntilFinished)
{
Continue();
}
}
// If there's other music playing in the scene, assign it the same tag as the new music you want to play and
// the old music will be automatically stopped.
protected void StopAudioWithSameTag()
protected virtual void StopAudioWithSameTag()
{
// Don't stop audio if there's no tag assigned
if (_audioSource.Value == null ||
@ -115,15 +76,15 @@ namespace Fungus.Commands
}
}
protected void PlayOnce()
protected virtual void PlayOnce()
{
if (fadeDuration > 0)
{
// Fade volume in
LeanTween.value(_audioSource.Value.gameObject,
_audioSource.Value.volume,
endVolume,
fadeDuration
_audioSource.Value.volume,
endVolume,
fadeDuration
).setOnUpdate(
(float updateVolume)=>{
_audioSource.Value.volume = updateVolume;
@ -150,7 +111,7 @@ namespace Fungus.Commands
Continue();
}
protected void PlayLoop()
protected virtual void PlayLoop()
{
if (fadeDuration > 0)
{
@ -179,7 +140,7 @@ namespace Fungus.Commands
}
}
protected void PauseLoop()
protected virtual void PauseLoop()
{
if (fadeDuration > 0)
{
@ -205,7 +166,7 @@ namespace Fungus.Commands
}
}
protected void StopLoop(AudioSource source)
protected virtual void StopLoop(AudioSource source)
{
if (fadeDuration > 0)
{
@ -231,7 +192,7 @@ namespace Fungus.Commands
}
}
protected void ChangeVolume()
protected virtual void ChangeVolume()
{
LeanTween.value(_audioSource.Value.gameObject,_audioSource.Value.volume,endVolume,fadeDuration
).setOnUpdate(
@ -246,7 +207,7 @@ namespace Fungus.Commands
});
}
void AudioFinished()
protected virtual void AudioFinished()
{
if (waitUntilFinished)
{
@ -254,6 +215,47 @@ namespace Fungus.Commands
}
}
#region Public members
public override void OnEnter()
{
if (_audioSource.Value == null)
{
Continue();
return;
}
if (control != ControlAudioType.ChangeVolume)
{
_audioSource.Value.volume = endVolume;
}
switch(control)
{
case ControlAudioType.PlayOnce:
StopAudioWithSameTag();
PlayOnce();
break;
case ControlAudioType.PlayLoop:
StopAudioWithSameTag();
PlayLoop();
break;
case ControlAudioType.PauseLoop:
PauseLoop();
break;
case ControlAudioType.StopLoop:
StopLoop(_audioSource.Value);
break;
case ControlAudioType.ChangeVolume:
ChangeVolume();
break;
}
if (!waitUntilFinished)
{
Continue();
}
}
public override string GetSummary()
{
if (_audioSource.Value == null)
@ -282,6 +284,8 @@ namespace Fungus.Commands
return new Color32(242, 209, 176, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("audioSource")] public AudioSource audioSourceOLD;

116
Assets/Fungus/Scripts/Commands/ControlStage.cs

@ -52,6 +52,64 @@ namespace Fungus.Commands
[Tooltip("Wait until the tween has finished before executing the next command")]
[SerializeField] protected bool waitUntilFinished = false;
protected virtual void Show(Stage stage, bool visible)
{
float duration = (fadeDuration == 0) ? float.Epsilon : fadeDuration;
float targetAlpha = visible ? 1f : 0f;
CanvasGroup canvasGroup = stage.GetComponentInChildren<CanvasGroup>();
if (canvasGroup == null)
{
Continue();
return;
}
LeanTween.value(canvasGroup.gameObject, canvasGroup.alpha, targetAlpha, duration).setOnUpdate( (float alpha) => {
canvasGroup.alpha = alpha;
}).setOnComplete( () => {
OnComplete();
});
}
protected virtual void MoveToFront(Stage stage)
{
foreach (Stage s in Stage.ActiveStages)
{
if (s == stage)
{
s.PortraitCanvas.sortingOrder = 1;
}
else
{
s.PortraitCanvas.sortingOrder = 0;
}
}
}
protected virtual void UndimAllPortraits(Stage stage)
{
stage.DimPortraits = false;
foreach (Character character in stage.CharactersOnStage)
{
stage.SetDimmed(character, false);
}
}
protected virtual void DimNonSpeakingPortraits(Stage stage)
{
stage.DimPortraits = true;
}
protected virtual void OnComplete()
{
if (waitUntilFinished)
{
Continue();
}
}
#region Public members
public override void OnEnter()
{
// If no display specified, do nothing
@ -123,62 +181,6 @@ namespace Fungus.Commands
}
}
protected void Show(Stage stage, bool visible)
{
float duration = (fadeDuration == 0) ? float.Epsilon : fadeDuration;
float targetAlpha = visible ? 1f : 0f;
CanvasGroup canvasGroup = stage.GetComponentInChildren<CanvasGroup>();
if (canvasGroup == null)
{
Continue();
return;
}
LeanTween.value(canvasGroup.gameObject, canvasGroup.alpha, targetAlpha, duration).setOnUpdate( (float alpha) => {
canvasGroup.alpha = alpha;
}).setOnComplete( () => {
OnComplete();
});
}
protected void MoveToFront(Stage stage)
{
foreach (Stage s in Stage.activeStages)
{
if (s == stage)
{
s.PortraitCanvas.sortingOrder = 1;
}
else
{
s.PortraitCanvas.sortingOrder = 0;
}
}
}
protected void UndimAllPortraits(Stage stage)
{
stage.DimPortraits = false;
foreach (Character character in stage.CharactersOnStage)
{
stage.SetDimmed(character, false);
}
}
protected void DimNonSpeakingPortraits(Stage stage)
{
stage.DimPortraits = true;
}
protected void OnComplete()
{
if (waitUntilFinished)
{
Continue();
}
}
public override string GetSummary()
{
string displaySummary = "";
@ -208,5 +210,7 @@ namespace Fungus.Commands
//Default to display type: show
display = StageDisplayType.Show;
}
#endregion
}
}

10
Assets/Fungus/Scripts/Commands/ControlWithDisplay.cs

@ -11,12 +11,16 @@ namespace Fungus.Commands
[Tooltip("Display type")]
[SerializeField] protected TDisplayEnum display;
public virtual TDisplayEnum Display { get { return display; } }
protected bool IsDisplayNone<TEnum>(TEnum enumValue)
protected virtual bool IsDisplayNone<TEnum>(TEnum enumValue)
{
string displayTypeStr = Enum.GetName(typeof (TEnum), enumValue);
return displayTypeStr == "None";
}
#region Public members
public virtual TDisplayEnum Display { get { return display; } }
#endregion
}
}

14
Assets/Fungus/Scripts/Commands/Conversation.cs

@ -27,11 +27,6 @@ namespace Fungus.Commands
conversationManager.PopulateCharacterCache();
}
public override void OnEnter()
{
StartCoroutine(DoConversation());
}
protected virtual IEnumerator DoConversation()
{
var flowchart = GetFlowchart();
@ -42,6 +37,13 @@ namespace Fungus.Commands
Continue();
}
#region Public members
public override void OnEnter()
{
StartCoroutine(DoConversation());
}
public override string GetSummary()
{
return conversationText.Value;
@ -51,5 +53,7 @@ namespace Fungus.Commands
{
return new Color32(184, 210, 235, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/DebugLog.cs

@ -34,6 +34,8 @@ namespace Fungus.Commands
[Tooltip("Text to write to the debug log. Supports variable substitution, e.g. {$Myvar}")]
[SerializeField] protected StringDataMulti logMessage;
#region Public members
public override void OnEnter ()
{
var flowchart = GetFlowchart();
@ -64,5 +66,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/DeleteSaveKey.cs

@ -17,6 +17,8 @@ namespace Fungus.Commands
[Tooltip("Name of the saved value. Supports variable substition e.g. \"player_{$PlayerNumber}")]
[SerializeField] protected string key = "";
#region Public members
public override void OnEnter()
{
if (key == "")
@ -49,5 +51,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/Destroy.cs

@ -20,6 +20,8 @@ namespace Fungus.Commands
[Tooltip("Reference to game object to destroy")]
[SerializeField] protected GameObjectData _targetGameObject;
#region Public members
public override void OnEnter()
{
if (_targetGameObject.Value != null)
@ -45,6 +47,8 @@ namespace Fungus.Commands
return new Color32(235, 191, 217, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("targetGameObject")] public GameObject targetGameObjectOLD;

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

@ -14,6 +14,8 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class Else : Command
{
#region Public members
public override void OnEnter()
{
if (ParentBlock == null)
@ -64,5 +66,7 @@ namespace Fungus.Commands
{
return new Color32(253, 253, 150, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/ElseIf.cs

@ -14,6 +14,8 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class ElseIf : If
{
#region Public members
public override void OnEnter()
{
System.Type previousCommandType = ParentBlock.GetPreviousActiveCommandType();
@ -73,5 +75,7 @@ namespace Fungus.Commands
{
return new Color32(253, 253, 150, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/End.cs

@ -14,6 +14,8 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class End : Command
{
#region Public members
public virtual bool Loop { get; set; }
public override void OnEnter()
@ -43,5 +45,7 @@ namespace Fungus.Commands
{
return new Color32(253, 253, 150, 255);
}
#endregion
}
}

50
Assets/Fungus/Scripts/Commands/ExecuteLua.cs

@ -108,29 +108,6 @@ namespace Fungus.Commands
return luaFile.text + "\n" + luaScript;
}
public override void OnEnter()
{
InitExecuteLua();
if (luaFunction == null)
{
Continue();
}
LuaEnv.RunLuaFunction(luaFunction, runAsCoroutine, (returnValue) => {
StoreReturnVariable(returnValue);
if (waitUntilFinished)
{
Continue();
}
});
if (!waitUntilFinished)
{
Continue();
}
}
protected virtual void StoreReturnVariable(DynValue returnValue)
{
if (returnVariable == null || returnValue == null)
@ -194,6 +171,31 @@ namespace Fungus.Commands
}
}
#region Public members
public override void OnEnter()
{
InitExecuteLua();
if (luaFunction == null)
{
Continue();
}
LuaEnv.RunLuaFunction(luaFunction, runAsCoroutine, (returnValue) => {
StoreReturnVariable(returnValue);
if (waitUntilFinished)
{
Continue();
}
});
if (!waitUntilFinished)
{
Continue();
}
}
public override string GetSummary()
{
return luaScript;
@ -203,5 +205,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/FadeScreen.cs

@ -31,6 +31,8 @@ namespace Fungus.Commands
[Tooltip("Optional texture to use when rendering the fullscreen fade effect.")]
[SerializeField] protected Texture2D fadeTexture;
#region Public members
public override void OnEnter()
{
var cameraController = CameraController.GetInstance();
@ -66,5 +68,7 @@ namespace Fungus.Commands
{
return new Color32(216, 228, 170, 255);
}
#endregion
}
}

12
Assets/Fungus/Scripts/Commands/FadeSprite.cs

@ -18,16 +18,18 @@ namespace Fungus.Commands
public class FadeSprite : Command
{
[Tooltip("Sprite object to be faded")]
public SpriteRenderer spriteRenderer;
[SerializeField] protected SpriteRenderer spriteRenderer;
[Tooltip("Length of time to perform the fade")]
public FloatData _duration = new FloatData(1f);
[SerializeField] protected FloatData _duration = new FloatData(1f);
[Tooltip("Target color to fade to. To only fade transparency level, set the color to white and set the alpha to required transparency.")]
public ColorData _targetColor = new ColorData(Color.white);
[SerializeField] protected ColorData _targetColor = new ColorData(Color.white);
[Tooltip("Wait until the fade has finished before executing the next command")]
public bool waitUntilFinished = true;
[SerializeField] protected bool waitUntilFinished = true;
#region Public members
public override void OnEnter()
{
@ -65,6 +67,8 @@ namespace Fungus.Commands
return new Color32(221, 184, 169, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD;

18
Assets/Fungus/Scripts/Commands/FadeToView.cs

@ -22,7 +22,6 @@ namespace Fungus.Commands
[Tooltip("View to transition to when Fade is complete")]
[SerializeField] protected View targetView;
public virtual View TargetView { get { return targetView; } }
[Tooltip("Wait until the fade has finished before executing next command")]
[SerializeField] protected bool waitUntilFinished = true;
@ -36,6 +35,11 @@ namespace Fungus.Commands
[Tooltip("Camera to use for the fade. Will use main camera if set to none.")]
[SerializeField] protected Camera targetCamera;
protected virtual void Start()
{
AcquireCamera();
}
protected virtual void AcquireCamera()
{
if (targetCamera != null)
@ -50,10 +54,12 @@ namespace Fungus.Commands
}
}
public virtual void Start()
{
AcquireCamera();
}
#region Public members
/// <summary>
/// View to transition to when Fade is complete
/// </summary>
public virtual View TargetView { get { return targetView; } }
public override void OnEnter()
{
@ -110,5 +116,7 @@ namespace Fungus.Commands
{
return new Color32(216, 228, 170, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/FadeUI.cs

@ -140,6 +140,8 @@ namespace Fungus.Commands
return "";
}
#region Public members
public override bool IsPropertyVisible(string propertyName)
{
if (fadeMode == FadeMode.Alpha &&
@ -156,5 +158,7 @@ namespace Fungus.Commands
return true;
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/Fullscreen.cs

@ -29,6 +29,8 @@ namespace Fungus.Commands
{
[SerializeField] protected FullscreenMode fullscreenMode;
#region Public members
public override void OnEnter()
{
switch (fullscreenMode)
@ -56,5 +58,7 @@ namespace Fungus.Commands
{
return new Color32(216, 228, 170, 255);
}
#endregion
}
}

8
Assets/Fungus/Scripts/Commands/GetText.cs

@ -24,6 +24,8 @@ namespace Fungus.Commands
[VariableProperty(typeof(StringVariable))]
[SerializeField] protected StringVariable stringVariable;
#region Public members
public override void OnEnter()
{
if (stringVariable == null)
@ -81,6 +83,10 @@ namespace Fungus.Commands
return new Color32(235, 191, 217, 255);
}
#endregion
#region Backwards compatibility
// Backwards compatibility with Fungus v2.1.2
[HideInInspector]
[FormerlySerializedAs("textObject")]
@ -92,5 +98,7 @@ namespace Fungus.Commands
targetTextObject = _textObjectObsolete.gameObject;
}
}
#endregion
}
}

96
Assets/Fungus/Scripts/Commands/If.cs

@ -34,52 +34,7 @@ namespace Fungus.Commands
[Tooltip("String value to compare against")]
[SerializeField] protected StringDataMulti stringData;
public override void OnEnter()
{
if (ParentBlock == null)
{
return;
}
if (variable == null)
{
Continue();
return;
}
EvaluateAndContinue();
}
public bool EvaluateCondition()
{
BooleanVariable booleanVariable = variable as BooleanVariable;
IntegerVariable integerVariable = variable as IntegerVariable;
FloatVariable floatVariable = variable as FloatVariable;
StringVariable stringVariable = variable as StringVariable;
bool condition = false;
if (booleanVariable != null)
{
condition = booleanVariable.Evaluate(compareOperator, booleanData.Value);
}
else if (integerVariable != null)
{
condition = integerVariable.Evaluate(compareOperator, integerData.Value);
}
else if (floatVariable != null)
{
condition = floatVariable.Evaluate(compareOperator, floatData.Value);
}
else if (stringVariable != null)
{
condition = stringVariable.Evaluate(compareOperator, stringData.Value);
}
return condition;
}
protected void EvaluateAndContinue()
protected virtual void EvaluateAndContinue()
{
if (EvaluateCondition())
{
@ -154,6 +109,53 @@ namespace Fungus.Commands
StopParentBlock();
}
protected virtual bool EvaluateCondition()
{
BooleanVariable booleanVariable = variable as BooleanVariable;
IntegerVariable integerVariable = variable as IntegerVariable;
FloatVariable floatVariable = variable as FloatVariable;
StringVariable stringVariable = variable as StringVariable;
bool condition = false;
if (booleanVariable != null)
{
condition = booleanVariable.Evaluate(compareOperator, booleanData.Value);
}
else if (integerVariable != null)
{
condition = integerVariable.Evaluate(compareOperator, integerData.Value);
}
else if (floatVariable != null)
{
condition = floatVariable.Evaluate(compareOperator, floatData.Value);
}
else if (stringVariable != null)
{
condition = stringVariable.Evaluate(compareOperator, stringData.Value);
}
return condition;
}
#region Public members
public override void OnEnter()
{
if (ParentBlock == null)
{
return;
}
if (variable == null)
{
Continue();
return;
}
EvaluateAndContinue();
}
public override string GetSummary()
{
if (variable == null)
@ -198,5 +200,7 @@ namespace Fungus.Commands
{
return new Color32(253, 253, 150, 255);
}
#endregion
}
}

63
Assets/Fungus/Scripts/Commands/InvokeEvent.cs

@ -37,14 +37,10 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class InvokeEvent : Command
{
[Serializable] public class BooleanEvent : UnityEvent<bool> {}
[Serializable] public class IntegerEvent : UnityEvent<int> {}
[Serializable] public class FloatEvent : UnityEvent<float> {}
[Serializable] public class StringEvent : UnityEvent<string> {}
[Tooltip("Delay (in seconds) before the methods will be called")]
[SerializeField] protected float delay;
[Tooltip("Selects type of method parameter to pass")]
[SerializeField] protected InvokeType invokeType;
[Tooltip("List of methods to call. Supports methods with no parameters or exactly one string, int, float or object parameter.")]
@ -74,9 +70,39 @@ namespace Fungus.Commands
[Tooltip("List of methods to call. Supports methods with one string parameter.")]
[SerializeField] protected StringEvent stringEvent = new StringEvent();
protected virtual void DoInvoke()
{
switch (invokeType)
{
default:
case InvokeType.Static:
staticEvent.Invoke();
break;
case InvokeType.DynamicBoolean:
booleanEvent.Invoke(booleanParameter.Value);
break;
case InvokeType.DynamicInteger:
integerEvent.Invoke(integerParameter.Value);
break;
case InvokeType.DynamicFloat:
floatEvent.Invoke(floatParameter.Value);
break;
case InvokeType.DynamicString:
stringEvent.Invoke(stringParameter.Value);
break;
}
}
#region Public members
[Serializable] public class BooleanEvent : UnityEvent<bool> {}
[Serializable] public class IntegerEvent : UnityEvent<int> {}
[Serializable] public class FloatEvent : UnityEvent<float> {}
[Serializable] public class StringEvent : UnityEvent<string> {}
public override void OnEnter()
{
if (delay == 0f)
if (Mathf.Approximately(delay, 0f))
{
DoInvoke();
}
@ -88,29 +114,6 @@ namespace Fungus.Commands
Continue();
}
protected virtual void DoInvoke()
{
switch (invokeType)
{
default:
case InvokeType.Static:
staticEvent.Invoke();
break;
case InvokeType.DynamicBoolean:
booleanEvent.Invoke(booleanParameter.Value);
break;
case InvokeType.DynamicInteger:
integerEvent.Invoke(integerParameter.Value);
break;
case InvokeType.DynamicFloat:
floatEvent.Invoke(floatParameter.Value);
break;
case InvokeType.DynamicString:
stringEvent.Invoke(stringParameter.Value);
break;
}
}
public override string GetSummary()
{
string summary = invokeType.ToString() + " ";
@ -142,5 +145,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

129
Assets/Fungus/Scripts/Commands/InvokeMethod.cs

@ -22,7 +22,6 @@ namespace Fungus.Commands
{
[Tooltip("GameObject containing the component method to be invoked")]
[SerializeField] protected GameObject targetObject;
public virtual GameObject TargetObject { get { return targetObject; } }
[HideInInspector]
[Tooltip("Name of assembly containing the target component")]
@ -96,47 +95,6 @@ namespace Fungus.Commands
}
}
public override void OnEnter()
{
try
{
if (targetObject == null || string.IsNullOrEmpty(targetComponentAssemblyName) || string.IsNullOrEmpty(targetMethod))
{
Continue();
return;
}
if (returnValueType != "System.Collections.IEnumerator")
{
var objReturnValue = objMethod.Invoke(objComponent, GetParameterValues());
if (saveReturnValue)
{
SetVariable(returnValueVariableKey, objReturnValue, returnValueType);
}
Continue();
}
else
{
StartCoroutine(ExecuteCoroutine());
if (callMode == CallMode.Continue)
{
Continue();
}
else if(callMode == CallMode.Stop)
{
StopParentBlock();
}
}
}
catch (System.Exception ex)
{
Debug.LogError("Error: " + ex.Message);
}
}
protected virtual IEnumerator ExecuteCoroutine()
{
yield return StartCoroutine((IEnumerator)objMethod.Invoke(objComponent, GetParameterValues()));
@ -147,22 +105,7 @@ namespace Fungus.Commands
}
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
public override string GetSummary()
{
if (targetObject == null)
{
return "Error: targetObject is not assigned";
}
return targetObject.name + "." + targetComponentText + "." + targetMethodText;
}
protected System.Type[] GetParameterTypes()
protected virtual System.Type[] GetParameterTypes()
{
System.Type[] types = new System.Type[methodParameters.Length];
@ -177,7 +120,7 @@ namespace Fungus.Commands
return types;
}
protected object[] GetParameterValues()
protected virtual object[] GetParameterValues()
{
object[] values = new object[methodParameters.Length];
var flowChart = GetFlowchart();
@ -265,7 +208,7 @@ namespace Fungus.Commands
return values;
}
protected void SetVariable(string key, object value, string returnType)
protected virtual void SetVariable(string key, object value, string returnType)
{
var flowChart = GetFlowchart();
@ -309,6 +252,71 @@ namespace Fungus.Commands
break;
}
}
#region Public members
/// <summary>
/// GameObject containing the component method to be invoked.
/// </summary>
public virtual GameObject TargetObject { get { return targetObject; } }
public override void OnEnter()
{
try
{
if (targetObject == null || string.IsNullOrEmpty(targetComponentAssemblyName) || string.IsNullOrEmpty(targetMethod))
{
Continue();
return;
}
if (returnValueType != "System.Collections.IEnumerator")
{
var objReturnValue = objMethod.Invoke(objComponent, GetParameterValues());
if (saveReturnValue)
{
SetVariable(returnValueVariableKey, objReturnValue, returnValueType);
}
Continue();
}
else
{
StartCoroutine(ExecuteCoroutine());
if (callMode == CallMode.Continue)
{
Continue();
}
else if(callMode == CallMode.Stop)
{
StopParentBlock();
}
}
}
catch (System.Exception ex)
{
Debug.LogError("Error: " + ex.Message);
}
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
public override string GetSummary()
{
if (targetObject == null)
{
return "Error: targetObject is not assigned";
}
return targetObject.name + "." + targetComponentText + "." + targetMethodText;
}
#endregion
}
[System.Serializable]
@ -317,7 +325,6 @@ namespace Fungus.Commands
[SerializeField]
public ObjectValue objValue;
[SerializeField]
public string variableKey;
}

4
Assets/Fungus/Scripts/Commands/Jump.cs

@ -20,6 +20,8 @@ namespace Fungus.Commands
[Tooltip("Name of a label in this block to jump to")]
[SerializeField] protected StringData _targetLabel = new StringData("");
#region Public members
public override void OnEnter()
{
if (_targetLabel.Value == "")
@ -59,6 +61,8 @@ namespace Fungus.Commands
return new Color32(253, 253, 150, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("targetLabel")] public Label targetLabelOLD;

8
Assets/Fungus/Scripts/Commands/Label.cs

@ -16,6 +16,12 @@ namespace Fungus.Commands
{
[Tooltip("Display name for the label")]
[SerializeField] protected string key = "";
#region Public members
/// <summary>
/// Display name for the label
/// </summary>
public virtual string Key { get { return key; } }
public override void OnEnter()
@ -32,5 +38,7 @@ namespace Fungus.Commands
{
return new Color32(200, 200, 253, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/LoadScene.cs

@ -29,6 +29,8 @@ namespace Fungus.Commands
[Tooltip("Image to display while loading the scene")]
[SerializeField] protected Texture2D loadingImage;
#region Public members
public override void OnEnter()
{
SceneLoader.LoadScene(_sceneName.Value, loadingImage);
@ -49,6 +51,8 @@ namespace Fungus.Commands
return new Color32(235, 191, 217, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("sceneName")] public string sceneNameOLD = "";

6
Assets/Fungus/Scripts/Commands/LoadVariable.cs

@ -23,7 +23,9 @@ namespace Fungus.Commands
typeof(IntegerVariable),
typeof(FloatVariable),
typeof(StringVariable))]
public Variable variable;
[SerializeField] protected Variable variable;
#region Public members
public override void OnEnter()
{
@ -97,5 +99,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/LookFrom.cs

@ -27,6 +27,8 @@ namespace Fungus.Commands
[Tooltip("Restricts rotation to the supplied axis only")]
[SerializeField] protected iTweenAxis axis;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -60,6 +62,8 @@ namespace Fungus.Commands
iTween.LookFrom(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD;

4
Assets/Fungus/Scripts/Commands/LookTo.cs

@ -27,6 +27,8 @@ namespace Fungus.Commands
[Tooltip("Restricts rotation to the supplied axis only")]
[SerializeField] protected iTweenAxis axis;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -60,6 +62,8 @@ namespace Fungus.Commands
iTween.LookTo(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD;

4
Assets/Fungus/Scripts/Commands/Menu.cs

@ -36,6 +36,8 @@ namespace Fungus.Commands
[Tooltip("A custom Menu Dialog to use to display this menu. All subsequent Menu commands will use this dialog.")]
[SerializeField] protected MenuDialog setMenuDialog;
#region Public member
public override void OnEnter()
{
if (setMenuDialog != null)
@ -91,6 +93,8 @@ namespace Fungus.Commands
return new Color32(184, 210, 235, 255);
}
#endregion
#region ILocalizable implementation
public virtual string GetStandardText()

4
Assets/Fungus/Scripts/Commands/MenuTimer.cs

@ -25,6 +25,8 @@ namespace Fungus.Commands
[Tooltip("Block to execute when the timer expires")]
[SerializeField] protected Block targetBlock;
#region Public members
public override void OnEnter()
{
var menuDialog = MenuDialog.GetMenuDialog();
@ -61,6 +63,8 @@ namespace Fungus.Commands
return new Color32(184, 210, 235, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD;

4
Assets/Fungus/Scripts/Commands/MoveAdd.cs

@ -24,6 +24,8 @@ namespace Fungus.Commands
[Tooltip("Apply the transformation in either the world coordinate or local cordinate system")]
[SerializeField] protected Space space = Space.Self;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -39,6 +41,8 @@ namespace Fungus.Commands
iTween.MoveAdd(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("offset")] public Vector3 offsetOLD;

4
Assets/Fungus/Scripts/Commands/MoveFrom.cs

@ -27,6 +27,8 @@ namespace Fungus.Commands
[Tooltip("Whether to animate in world space or relative to the parent. False by default.")]
[SerializeField] protected bool isLocal;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -49,6 +51,8 @@ namespace Fungus.Commands
iTween.MoveFrom(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD;

4
Assets/Fungus/Scripts/Commands/MoveTo.cs

@ -27,6 +27,8 @@ namespace Fungus.Commands
[Tooltip("Whether to animate in world space or relative to the parent. False by default.")]
[SerializeField] protected bool isLocal;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -49,6 +51,8 @@ namespace Fungus.Commands
iTween.MoveTo(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD;

4
Assets/Fungus/Scripts/Commands/MoveToView.cs

@ -46,6 +46,8 @@ namespace Fungus.Commands
AcquireCamera();
}
#region Public members
public override void OnEnter()
{
AcquireCamera();
@ -96,5 +98,7 @@ namespace Fungus.Commands
{
return new Color32(216, 228, 170, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/OpenURL.cs

@ -18,6 +18,8 @@ namespace Fungus.Commands
[Tooltip("URL to open in the browser")]
[SerializeField] protected StringData url = new StringData();
#region Public members
public override void OnEnter()
{
Application.OpenURL(url.Value);
@ -34,5 +36,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/PlayAnimState.cs

@ -27,6 +27,8 @@ namespace Fungus.Commands
[Tooltip("Start time of animation")]
[SerializeField] protected FloatData time = new FloatData(0f);
#region Public members
public override void OnEnter()
{
if (animator.Value != null)
@ -51,6 +53,8 @@ namespace Fungus.Commands
{
return new Color32(170, 204, 169, 255);
}
#endregion
}
}

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

@ -26,6 +26,8 @@ namespace Fungus.Commands
[Tooltip("Length of time to fade out previous playing music.")]
[SerializeField] protected float fadeDuration = 1f;
#region Public members
public override void OnEnter()
{
var musicController = MusicController.GetInstance();
@ -52,5 +54,7 @@ namespace Fungus.Commands
{
return new Color32(242, 209, 176, 255);
}
#endregion
}
}

14
Assets/Fungus/Scripts/Commands/PlaySound.cs

@ -24,6 +24,13 @@ namespace Fungus.Commands
[Tooltip("Wait until the sound has finished playing before continuing execution.")]
[SerializeField] protected bool waitUntilFinished;
protected virtual void DoWait()
{
Continue();
}
#region Public members
public override void OnEnter()
{
if (soundClip == null)
@ -48,11 +55,6 @@ namespace Fungus.Commands
}
}
protected virtual void DoWait()
{
Continue();
}
public override string GetSummary()
{
if (soundClip == null)
@ -67,5 +69,7 @@ namespace Fungus.Commands
{
return new Color32(242, 209, 176, 255);
}
#endregion
}
}

18
Assets/Fungus/Scripts/Commands/PlayUsfxrSound.cs

@ -30,7 +30,7 @@ using Fungus.Variables;
protected SfxrSynth _synth = new SfxrSynth();
//Call this if the settings have changed
protected void UpdateCache()
protected virtual void UpdateCache()
{
if (_SettingsString.Value != null)
{
@ -39,12 +39,19 @@ using Fungus.Variables;
}
}
public void Awake()
protected virtual void Awake()
{
//Always build the cache on awake
UpdateCache();
}
protected void DoWait()
{
Continue();
}
#region Public members
public override void OnEnter()
{
_synth.SetParentTransform(ParentTransform);
@ -59,11 +66,6 @@ using Fungus.Variables;
}
}
protected void DoWait()
{
Continue();
}
public override string GetSummary()
{
if (String.IsNullOrEmpty(_SettingsString.Value))
@ -82,6 +84,8 @@ using Fungus.Variables;
return new Color32(128, 200, 200, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("SettingsString")] public String SettingsStringOLD = "";

70
Assets/Fungus/Scripts/Commands/Portrait.cs

@ -16,38 +16,30 @@ namespace Fungus.Commands
{
[Tooltip("Stage to display portrait on")]
[SerializeField] protected Stage stage;
public virtual Stage _Stage { get { return stage; } set { stage = value; } }
[Tooltip("Character to display")]
[SerializeField] protected Character character;
public virtual Character _Character { get { return character; } set { character = value; } }
[Tooltip("Character to swap with")]
[SerializeField] protected Character replacedCharacter;
[Tooltip("Portrait to display")]
[SerializeField] protected Sprite portrait;
public virtual Sprite _Portrait { get { return portrait; } set { portrait = value; } }
[Tooltip("Move the portrait from/to this offset position")]
[SerializeField] protected PositionOffset offset;
public virtual PositionOffset Offset { get { return offset; } set { offset = value; } }
[Tooltip("Move the portrait from this position")]
[SerializeField] protected RectTransform fromPosition;
public virtual RectTransform FromPosition { get { return fromPosition; } set { fromPosition = value;} }
[Tooltip("Move the portrait to this positoin")]
[Tooltip("Move the portrait to this position")]
[SerializeField] protected RectTransform toPosition;
public virtual RectTransform ToPosition { get { return toPosition; } set { toPosition = value;} }
[Tooltip("Direction character is facing")]
[SerializeField] protected FacingDirection facing;
public virtual FacingDirection Facing { get { return facing; } set { facing = value; } }
[Tooltip("Use Default Settings")]
[SerializeField] protected bool useDefaultSettings = true;
public virtual bool UseDefaultSettings { get { return useDefaultSettings; } set { useDefaultSettings = value; } }
[Tooltip("Fade Duration")]
[SerializeField] protected float fadeDuration = 0.5f;
@ -58,17 +50,67 @@ namespace Fungus.Commands
[Tooltip("Shift Offset")]
[SerializeField] protected Vector2 shiftOffset;
[Tooltip("Move")]
[Tooltip("Move portrait into new position")]
[SerializeField] protected bool move;
public virtual bool Move { get { return move; } set { move = value; } }
[Tooltip("Start from offset")]
[Tooltip("Start from offset position")]
[SerializeField] protected bool shiftIntoPlace;
public virtual bool ShiftIntoPlace { get { return shiftIntoPlace; } set { shiftIntoPlace = value; } }
[Tooltip("Wait until the tween has finished before executing the next command")]
[SerializeField] protected bool waitUntilFinished = false;
#region Public members
/// <summary>
/// Stage to display portrait on.
/// </summary>
public virtual Stage _Stage { get { return stage; } set { stage = value; } }
/// <summary>
/// Character to display.
/// </summary>
public virtual Character _Character { get { return character; } set { character = value; } }
/// <summary>
/// Portrait to display.
/// </summary>
public virtual Sprite _Portrait { get { return portrait; } set { portrait = value; } }
/// <summary>
/// Move the portrait from/to this offset position.
/// </summary>
public virtual PositionOffset Offset { get { return offset; } set { offset = value; } }
/// <summary>
/// Move the portrait from this position.
/// </summary>
public virtual RectTransform FromPosition { get { return fromPosition; } set { fromPosition = value;} }
/// <summary>
/// Move the portrait to this position.
/// </summary>
public virtual RectTransform ToPosition { get { return toPosition; } set { toPosition = value;} }
/// <summary>
/// Direction character is facing.
/// </summary>
public virtual FacingDirection Facing { get { return facing; } set { facing = value; } }
/// <summary>
/// Use Default Settings.
/// </summary>
public virtual bool UseDefaultSettings { get { return useDefaultSettings; } set { useDefaultSettings = value; } }
/// <summary>
/// Move portrait into new position.
/// </summary>
public virtual bool Move { get { return move; } set { move = value; } }
/// <summary>
/// Start from offset position.
/// </summary>
public virtual bool ShiftIntoPlace { get { return shiftIntoPlace; } set { shiftIntoPlace = value; } }
public override void OnEnter()
{
// Selected "use default Portrait Stage"
@ -213,5 +255,7 @@ namespace Fungus.Commands
//Default to display type: show
display = DisplayType.Show;
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/PunchPosition.cs

@ -24,6 +24,8 @@ namespace Fungus.Commands
[Tooltip("Apply the transformation in either the world coordinate or local cordinate system")]
[SerializeField] protected Space space = Space.Self;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -39,6 +41,8 @@ namespace Fungus.Commands
iTween.PunchPosition(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;

4
Assets/Fungus/Scripts/Commands/PunchRotation.cs

@ -24,6 +24,8 @@ namespace Fungus.Commands
[Tooltip("Apply the transformation in either the world coordinate or local cordinate system")]
[SerializeField] protected Space space = Space.Self;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -39,6 +41,8 @@ namespace Fungus.Commands
iTween.PunchRotation(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;

4
Assets/Fungus/Scripts/Commands/PunchScale.cs

@ -21,6 +21,8 @@ namespace Fungus.Commands
[Tooltip("A scale offset in space the GameObject will animate to")]
[SerializeField] protected Vector3Data _amount;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -35,6 +37,8 @@ namespace Fungus.Commands
iTween.PunchScale(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;

4
Assets/Fungus/Scripts/Commands/Quit.cs

@ -14,6 +14,8 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class Quit : Command
{
#region Public members
public override void OnEnter()
{
Application.Quit();
@ -26,5 +28,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/RandomFloat.cs

@ -25,6 +25,8 @@ namespace Fungus.Commands
[Tooltip("Maximum value for random range")]
[SerializeField] protected FloatData maxValue;
#region Public members
public override void OnEnter()
{
if (variable != null)
@ -54,5 +56,7 @@ namespace Fungus.Commands
{
return new Color32(253, 253, 150, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/RandomInteger.cs

@ -25,6 +25,8 @@ namespace Fungus.Commands
[Tooltip("Maximum value for random range")]
[SerializeField] protected IntegerData maxValue;
#region Public members
public override void OnEnter()
{
if (variable != null)
@ -54,5 +56,7 @@ namespace Fungus.Commands
{
return new Color32(253, 253, 150, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/ReadTextFile.cs

@ -22,6 +22,8 @@ namespace Fungus.Commands
[VariableProperty(typeof(StringVariable))]
[SerializeField] protected StringVariable stringVariable;
#region Public members
public override void OnEnter()
{
if (textFile == null ||
@ -60,5 +62,7 @@ namespace Fungus.Commands
{
return new Color32(253, 253, 150, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/Reset.cs

@ -20,6 +20,8 @@ namespace Fungus.Commands
[Tooltip("Reset variables back to their default values")]
[SerializeField] protected bool resetVariables = true;
#region Public members
public override void OnEnter()
{
GetFlowchart().Reset(resetCommands, resetVariables);
@ -30,5 +32,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/ResetAnimTrigger.cs

@ -23,6 +23,8 @@ namespace Fungus.Commands
[Tooltip("Name of the trigger Animator parameter that will be reset")]
[SerializeField] protected StringData _parameterName;
#region Public members
public override void OnEnter()
{
if (_animator.Value != null)
@ -48,6 +50,8 @@ namespace Fungus.Commands
return new Color32(170, 204, 169, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD;

4
Assets/Fungus/Scripts/Commands/RotateAdd.cs

@ -24,6 +24,8 @@ namespace Fungus.Commands
[Tooltip("Apply the transformation in either the world coordinate or local cordinate system")]
[SerializeField] protected Space space = Space.Self;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -39,6 +41,8 @@ namespace Fungus.Commands
iTween.RotateAdd(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("offset")] public Vector3 offsetOLD;

4
Assets/Fungus/Scripts/Commands/RotateFrom.cs

@ -27,6 +27,8 @@ namespace Fungus.Commands
[Tooltip("Whether to animate in world space or relative to the parent. False by default.")]
[SerializeField] protected bool isLocal;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -49,6 +51,8 @@ namespace Fungus.Commands
iTween.RotateFrom(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD;

4
Assets/Fungus/Scripts/Commands/RotateTo.cs

@ -27,6 +27,8 @@ namespace Fungus.Commands
[Tooltip("Whether to animate in world space or relative to the parent. False by default.")]
[SerializeField] protected bool isLocal;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -49,6 +51,8 @@ namespace Fungus.Commands
iTween.RotateTo(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD;

6
Assets/Fungus/Scripts/Commands/SaveVariable.cs

@ -27,7 +27,9 @@ namespace Fungus.Commands
typeof(IntegerVariable),
typeof(FloatVariable),
typeof(StringVariable))]
public Variable variable;
[SerializeField] protected Variable variable;
#region Public members
public override void OnEnter()
{
@ -101,5 +103,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

22
Assets/Fungus/Scripts/Commands/Say.cs

@ -23,11 +23,9 @@ namespace Fungus.Commands
[Tooltip("Character that is speaking")]
[SerializeField] protected Character character;
public virtual Character _Character { get { return character; } }
[Tooltip("Portrait that represents speaking character")]
[SerializeField] protected Sprite portrait;
public virtual Sprite Portrait { get { return portrait; } set { portrait = value; } }
[Tooltip("Voiceover audio to play when writing the text")]
[SerializeField] protected AudioClip voiceOverClip;
@ -40,7 +38,6 @@ namespace Fungus.Commands
[Tooltip("Type this text in the previous dialog box.")]
[SerializeField] protected bool extendPrevious = false;
public virtual bool ExtendPrevious { get { return extendPrevious; } }
[Tooltip("Fade out the dialog box when writing has finished and not waiting for input.")]
[SerializeField] protected bool fadeWhenDone = true;
@ -56,6 +53,23 @@ namespace Fungus.Commands
protected int executionCount;
#region Public members
/// <summary>
/// Character that is speaking.
/// </summary>
public virtual Character _Character { get { return character; } }
/// <summary>
/// Portrait that represents speaking character.
/// </summary>
public virtual Sprite Portrait { get { return portrait; } set { portrait = value; } }
/// <summary>
/// Type this text in the previous dialog box.
/// </summary>
public virtual bool ExtendPrevious { get { return extendPrevious; } }
public override void OnEnter()
{
if (!showAlways && executionCount >= showCount)
@ -144,6 +158,8 @@ namespace Fungus.Commands
sayDialog.Stop();
}
#endregion
#region ILocalizable implementation
public virtual string GetStandardText()

4
Assets/Fungus/Scripts/Commands/ScaleAdd.cs

@ -21,6 +21,8 @@ namespace Fungus.Commands
[Tooltip("A scale offset in space the GameObject will animate to")]
[SerializeField] protected Vector3Data _offset;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -35,6 +37,8 @@ namespace Fungus.Commands
iTween.ScaleAdd(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("offset")] public Vector3 offsetOLD;

4
Assets/Fungus/Scripts/Commands/ScaleFrom.cs

@ -24,6 +24,8 @@ namespace Fungus.Commands
[Tooltip("Target scale that the GameObject will scale from, if no From Transform is set")]
[SerializeField] protected Vector3Data _fromScale;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -45,6 +47,8 @@ namespace Fungus.Commands
iTween.ScaleFrom(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD;

4
Assets/Fungus/Scripts/Commands/ScaleTo.cs

@ -24,6 +24,8 @@ namespace Fungus.Commands
[Tooltip("Target scale that the GameObject will scale to, if no To Transform is set")]
[SerializeField] protected Vector3Data _toScale = new Vector3Data(Vector3.one);
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -45,6 +47,8 @@ namespace Fungus.Commands
iTween.ScaleTo(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD;

4
Assets/Fungus/Scripts/Commands/SendMessage.cs

@ -39,6 +39,8 @@ namespace Fungus.Commands
[Tooltip("Name of the message to send")]
[SerializeField] protected StringData _message = new StringData("");
#region Public members
public override void OnEnter()
{
if (_message.Value.Length == 0)
@ -83,6 +85,8 @@ namespace Fungus.Commands
return new Color32(235, 191, 217, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("message")] public string messageOLD = "";

4
Assets/Fungus/Scripts/Commands/SetActive.cs

@ -23,6 +23,8 @@ namespace Fungus.Commands
[Tooltip("Set to true to enable the game object")]
[SerializeField] protected BooleanData activeState;
#region Public members
public override void OnEnter()
{
if (_targetGameObject.Value != null)
@ -48,6 +50,8 @@ namespace Fungus.Commands
return new Color32(235, 191, 217, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("targetGameObject")] public GameObject targetGameObjectOLD;

4
Assets/Fungus/Scripts/Commands/SetAnimBool.cs

@ -26,6 +26,8 @@ namespace Fungus.Commands
[Tooltip("The boolean value to set the parameter to")]
[SerializeField] protected BooleanData value;
#region Public members
public override void OnEnter()
{
if (_animator.Value != null)
@ -51,6 +53,8 @@ namespace Fungus.Commands
return new Color32(170, 204, 169, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD;

4
Assets/Fungus/Scripts/Commands/SetAnimFloat.cs

@ -26,6 +26,8 @@ namespace Fungus.Commands
[Tooltip("The float value to set the parameter to")]
[SerializeField] protected FloatData value;
#region Public members
public override void OnEnter()
{
if (_animator.Value != null)
@ -51,6 +53,8 @@ namespace Fungus.Commands
return new Color32(170, 204, 169, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD;

4
Assets/Fungus/Scripts/Commands/SetAnimInteger.cs

@ -26,6 +26,8 @@ namespace Fungus.Commands
[Tooltip("The integer value to set the parameter to")]
[SerializeField] protected IntegerData value;
#region Public members
public override void OnEnter()
{
if (_animator.Value != null)
@ -51,6 +53,8 @@ namespace Fungus.Commands
return new Color32(170, 204, 169, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD;

4
Assets/Fungus/Scripts/Commands/SetAnimTrigger.cs

@ -23,6 +23,8 @@ namespace Fungus.Commands
[Tooltip("Name of the trigger Animator parameter that will have its value changed")]
[SerializeField] protected StringData _parameterName;
#region Public members
public override void OnEnter()
{
if (_animator.Value != null)
@ -48,6 +50,8 @@ namespace Fungus.Commands
return new Color32(170, 204, 169, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD;

4
Assets/Fungus/Scripts/Commands/SetAudioPitch.cs

@ -25,6 +25,8 @@ namespace Fungus.Commands
[Tooltip("Wait until the pitch change has finished before executing next command")]
[SerializeField] protected bool waitUntilFinished = true;
#region Public members
public override void OnEnter()
{
System.Action onComplete = () => {
@ -55,5 +57,7 @@ namespace Fungus.Commands
{
return new Color32(242, 209, 176, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/SetAudioVolume.cs

@ -25,6 +25,8 @@ namespace Fungus.Commands
[Tooltip("Wait until the volume fade has completed before continuing.")]
[SerializeField] protected bool waitUntilFinished = true;
#region Public members
public override void OnEnter()
{
var musicController = MusicController.GetInstance();
@ -53,5 +55,7 @@ namespace Fungus.Commands
{
return new Color32(242, 209, 176, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/SetClickable2D.cs

@ -21,6 +21,8 @@ namespace Fungus.Commands
[Tooltip("Set to true to enable the component")]
[SerializeField] protected BooleanData activeState;
#region Public members
public override void OnEnter()
{
if (targetClickable2D != null)
@ -45,6 +47,8 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

40
Assets/Fungus/Scripts/Commands/SetCollider.cs

@ -25,6 +25,26 @@ namespace Fungus.Commands
[Tooltip("Set to true to enable the collider components")]
[SerializeField] protected BooleanData activeState;
protected virtual void SetColliderActive(GameObject go)
{
if (go != null)
{
// 3D objects
foreach (Collider c in go.GetComponentsInChildren<Collider>())
{
c.enabled = activeState.Value;
}
// 2D objects
foreach (Collider2D c in go.GetComponentsInChildren<Collider2D>())
{
c.enabled = activeState.Value;
}
}
}
#region Public members
public override void OnEnter()
{
foreach (GameObject go in targetObjects)
@ -53,24 +73,6 @@ namespace Fungus.Commands
Continue();
}
protected virtual void SetColliderActive(GameObject go)
{
if (go != null)
{
// 3D objects
foreach (Collider c in go.GetComponentsInChildren<Collider>())
{
c.enabled = activeState.Value;
}
// 2D objects
foreach (Collider2D c in go.GetComponentsInChildren<Collider2D>())
{
c.enabled = activeState.Value;
}
}
}
public override string GetSummary()
{
int count = targetObjects.Count;
@ -89,6 +91,8 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/SetDraggable2D.cs

@ -21,6 +21,8 @@ namespace Fungus.Commands
[Tooltip("Set to true to enable the component")]
[SerializeField] protected BooleanData activeState;
#region Public members
public override void OnEnter()
{
if (targetDraggable2D != null)
@ -45,5 +47,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/SetInteractable.cs

@ -22,6 +22,8 @@ namespace Fungus.Commands
[Tooltip("Controls if the selectable UI object be interactable or not")]
[SerializeField] protected BooleanData interactableState = new BooleanData(true);
#region Public members
public override void OnEnter()
{
if (targetObjects.Count == 0)
@ -96,5 +98,7 @@ namespace Fungus.Commands
return false;
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/SetLanguage.cs

@ -20,6 +20,8 @@ namespace Fungus.Commands
[Tooltip("Code of the language to set. e.g. ES, DE, JA")]
[SerializeField] protected StringData _languageCode = new StringData();
#region Public members
public static string mostRecentLanguage = "";
public override void OnEnter()
@ -47,6 +49,8 @@ namespace Fungus.Commands
return new Color32(184, 210, 235, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("languageCode")] public string languageCodeOLD = "";

32
Assets/Fungus/Scripts/Commands/SetLayerOrder.cs

@ -20,6 +20,23 @@ namespace Fungus.Commands
[Tooltip("The New Layer Name to apply")]
[SerializeField] protected string sortingLayer;
protected void ApplySortingLayer(Transform target, string layerName)
{
Renderer renderer = target.gameObject.GetComponent<Renderer>();
if (renderer)
{
renderer.sortingLayerName = layerName;
Debug.Log(target.name);
}
foreach (Transform child in target.transform)
{
ApplySortingLayer(child, layerName);
}
}
#region Public members
public override void OnEnter()
{
if (targetObject != null)
@ -45,19 +62,6 @@ namespace Fungus.Commands
return new Color32(235, 191, 217, 255);
}
protected void ApplySortingLayer(Transform target, string layerName)
{
Renderer renderer = target.gameObject.GetComponent<Renderer>();
if (renderer)
{
renderer.sortingLayerName = layerName;
Debug.Log(target.name);
}
foreach (Transform child in target.transform)
{
ApplySortingLayer(child, layerName);
}
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/SetMenuDialog.cs

@ -17,6 +17,8 @@ namespace Fungus.Commands
[Tooltip("The Menu Dialog to use for displaying menu buttons")]
[SerializeField] protected MenuDialog menuDialog;
#region Public members
public override void OnEnter()
{
if (menuDialog != null)
@ -41,5 +43,7 @@ namespace Fungus.Commands
{
return new Color32(184, 210, 235, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/SetMouseCursor.cs

@ -24,6 +24,8 @@ namespace Fungus.Commands
protected static Texture2D activeCursorTexture;
protected static Vector2 activeHotspot;
#region Public members
public static void ResetMouseCursor()
{
// Change mouse cursor back to most recent settings
@ -54,5 +56,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

10
Assets/Fungus/Scripts/Commands/SetSaveProfile.cs

@ -16,14 +16,16 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class SetSaveProfile : Command
{
[Tooltip("Name of save profile to make active.")]
[SerializeField] protected string saveProfileName = "";
#region Public members
/// <summary>
/// Shared save profile name used by SaveVariable and LoadVariable.
/// </summary>
public static string saveProfile = "";
[Tooltip("Name of save profile to make active.")]
[SerializeField] protected string saveProfileName = "";
public override void OnEnter()
{
saveProfile = saveProfileName;
@ -40,5 +42,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/SetSayDialog.cs

@ -17,6 +17,8 @@ namespace Fungus.Commands
[Tooltip("The Say Dialog to use for displaying Say story text")]
[SerializeField] protected SayDialog sayDialog;
#region Public members
public override void OnEnter()
{
if (sayDialog != null)
@ -41,5 +43,7 @@ namespace Fungus.Commands
{
return new Color32(184, 210, 235, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/SetSliderValue.cs

@ -21,6 +21,8 @@ namespace Fungus.Commands
[Tooltip("Float value to set the slider value to.")]
[SerializeField] protected FloatData value;
#region Public members
public override void OnEnter()
{
slider.value = value;
@ -42,5 +44,7 @@ namespace Fungus.Commands
return slider.name + " = " + value.GetDescription();
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/SetSpriteOrder.cs

@ -22,6 +22,8 @@ namespace Fungus.Commands
[Tooltip("The order in layer value to set on the target sprites")]
[SerializeField] protected IntegerData orderInLayer;
#region Public members
public override void OnEnter()
{
foreach (SpriteRenderer spriteRenderer in targetSprites)
@ -78,5 +80,7 @@ namespace Fungus.Commands
// Add a default empty entry
targetSprites.Add(null);
}
#endregion
}
}

30
Assets/Fungus/Scripts/Commands/SetText.cs

@ -27,6 +27,8 @@ namespace Fungus.Commands
[Tooltip("Notes about this story text for other authors, localization, etc.")]
[SerializeField] protected string description;
#region Public members
public override void OnEnter()
{
var flowchart = GetFlowchart();
@ -79,17 +81,7 @@ namespace Fungus.Commands
return new Color32(235, 191, 217, 255);
}
// Backwards compatibility with Fungus v2.1.2
[HideInInspector]
[FormerlySerializedAs("textObject")]
public Text _textObjectObsolete;
protected virtual void OnEnable()
{
if (_textObjectObsolete != null)
{
targetTextObject = _textObjectObsolete.gameObject;
}
}
#endregion
#region ILocalizable implementation
@ -115,5 +107,21 @@ namespace Fungus.Commands
}
#endregion
#region Backwards compatibility
// Backwards compatibility with Fungus v2.1.2
[HideInInspector]
[FormerlySerializedAs("textObject")]
public Text _textObjectObsolete;
protected virtual void OnEnable()
{
if (_textObjectObsolete != null)
{
targetTextObject = _textObjectObsolete.gameObject;
}
}
#endregion
}
}

184
Assets/Fungus/Scripts/Commands/SetVariable.cs

@ -43,7 +43,6 @@ namespace Fungus.Commands
[Tooltip("The type of math operation to be performed")]
[SerializeField] protected SetOperator setOperator;
public virtual SetOperator _SetOperator { get { return setOperator; } }
[Tooltip("Boolean value to set with")]
[SerializeField] protected BooleanData booleanData;
@ -57,6 +56,101 @@ namespace Fungus.Commands
[Tooltip("String value to set with")]
[SerializeField] protected StringDataMulti stringData;
protected virtual void DoSetOperation()
{
if (variable == null)
{
return;
}
if (variable.GetType() == typeof(BooleanVariable))
{
BooleanVariable lhs = (variable as BooleanVariable);
bool rhs = booleanData.Value;
switch (setOperator)
{
default:
case SetOperator.Assign:
lhs.Value = rhs;
break;
case SetOperator.Negate:
lhs.Value = !rhs;
break;
}
}
else if (variable.GetType() == typeof(IntegerVariable))
{
IntegerVariable lhs = (variable as IntegerVariable);
int rhs = integerData.Value;
switch (setOperator)
{
default:
case SetOperator.Assign:
lhs.Value = rhs;
break;
case SetOperator.Add:
lhs.Value += rhs;
break;
case SetOperator.Subtract:
lhs.Value -= rhs;
break;
case SetOperator.Multiply:
lhs.Value *= rhs;
break;
case SetOperator.Divide:
lhs.Value /= rhs;
break;
}
}
else if (variable.GetType() == typeof(FloatVariable))
{
FloatVariable lhs = (variable as FloatVariable);
float rhs = floatData.Value;
switch (setOperator)
{
default:
case SetOperator.Assign:
lhs.Value = rhs;
break;
case SetOperator.Add:
lhs.Value += rhs;
break;
case SetOperator.Subtract:
lhs.Value -= rhs;
break;
case SetOperator.Multiply:
lhs.Value *= rhs;
break;
case SetOperator.Divide:
lhs.Value /= rhs;
break;
}
}
else if (variable.GetType() == typeof(StringVariable))
{
StringVariable lhs = (variable as StringVariable);
string rhs = stringData.Value;
switch (setOperator)
{
default:
case SetOperator.Assign:
lhs.Value = rhs;
break;
}
}
}
#region Public members
/// <summary>
/// The type of math operation to be performed.
/// </summary>
public virtual SetOperator _SetOperator { get { return setOperator; } }
public override void OnEnter()
{
DoSetOperation();
@ -126,92 +220,6 @@ namespace Fungus.Commands
return new Color32(253, 253, 150, 255);
}
protected virtual void DoSetOperation()
{
if (variable == null)
{
return;
}
if (variable.GetType() == typeof(BooleanVariable))
{
BooleanVariable lhs = (variable as BooleanVariable);
bool rhs = booleanData.Value;
switch (setOperator)
{
default:
case SetOperator.Assign:
lhs.Value = rhs;
break;
case SetOperator.Negate:
lhs.Value = !rhs;
break;
}
}
else if (variable.GetType() == typeof(IntegerVariable))
{
IntegerVariable lhs = (variable as IntegerVariable);
int rhs = integerData.Value;
switch (setOperator)
{
default:
case SetOperator.Assign:
lhs.Value = rhs;
break;
case SetOperator.Add:
lhs.Value += rhs;
break;
case SetOperator.Subtract:
lhs.Value -= rhs;
break;
case SetOperator.Multiply:
lhs.Value *= rhs;
break;
case SetOperator.Divide:
lhs.Value /= rhs;
break;
}
}
else if (variable.GetType() == typeof(FloatVariable))
{
FloatVariable lhs = (variable as FloatVariable);
float rhs = floatData.Value;
switch (setOperator)
{
default:
case SetOperator.Assign:
lhs.Value = rhs;
break;
case SetOperator.Add:
lhs.Value += rhs;
break;
case SetOperator.Subtract:
lhs.Value -= rhs;
break;
case SetOperator.Multiply:
lhs.Value *= rhs;
break;
case SetOperator.Divide:
lhs.Value /= rhs;
break;
}
}
else if (variable.GetType() == typeof(StringVariable))
{
StringVariable lhs = (variable as StringVariable);
string rhs = stringData.Value;
switch (setOperator)
{
default:
case SetOperator.Assign:
lhs.Value = rhs;
break;
}
}
}
#endregion
}
}

28
Assets/Fungus/Scripts/Commands/ShakeCamera.cs

@ -24,6 +24,20 @@ namespace Fungus.Commands
[Tooltip("Wait until the shake effect has finished before executing next command")]
[SerializeField] protected bool waitUntilFinished;
protected virtual void OniTweenComplete(object param)
{
Command command = param as Command;
if (command != null && command.Equals(this))
{
if (waitUntilFinished)
{
Continue();
}
}
}
#region Public members
public override void OnEnter()
{
Vector3 v = new Vector3();
@ -43,18 +57,6 @@ namespace Fungus.Commands
}
}
protected virtual void OniTweenComplete(object param)
{
Command command = param as Command;
if (command != null && command.Equals(this))
{
if (waitUntilFinished)
{
Continue();
}
}
}
public override string GetSummary()
{
return "For " + duration + " seconds.";
@ -64,5 +66,7 @@ namespace Fungus.Commands
{
return new Color32(216, 228, 170, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/ShakePosition.cs

@ -27,6 +27,8 @@ namespace Fungus.Commands
[Tooltip("Restricts rotation to the supplied axis only")]
[SerializeField] protected iTweenAxis axis;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -54,6 +56,8 @@ namespace Fungus.Commands
iTween.ShakePosition(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;

4
Assets/Fungus/Scripts/Commands/ShakeRotation.cs

@ -24,6 +24,8 @@ namespace Fungus.Commands
[Tooltip("Apply the transformation in either the world coordinate or local cordinate system")]
[SerializeField] protected Space space = Space.Self;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -39,6 +41,8 @@ namespace Fungus.Commands
iTween.ShakeRotation(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;

4
Assets/Fungus/Scripts/Commands/ShakeScale.cs

@ -21,6 +21,8 @@ namespace Fungus.Commands
[Tooltip("A scale offset in space the GameObject will animate to")]
[SerializeField] protected Vector3Data _amount;
#region Public members
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
@ -35,6 +37,8 @@ namespace Fungus.Commands
iTween.ShakeScale(_targetObject.Value, tweenParams);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;

18
Assets/Fungus/Scripts/Commands/ShowSprite.cs

@ -26,6 +26,15 @@ namespace Fungus.Commands
[Tooltip("Affect the visibility of child sprites")]
[SerializeField] protected bool affectChildren = true;
protected virtual void SetSpriteAlpha(SpriteRenderer renderer, bool visible)
{
Color spriteColor = renderer.color;
spriteColor.a = visible ? 1f : 0f;
renderer.color = spriteColor;
}
#region Public members
public override void OnEnter()
{
if (spriteRenderer != null)
@ -47,13 +56,6 @@ namespace Fungus.Commands
Continue();
}
protected virtual void SetSpriteAlpha(SpriteRenderer renderer, bool visible)
{
Color spriteColor = renderer.color;
spriteColor.a = visible ? 1f : 0f;
renderer.color = spriteColor;
}
public override string GetSummary()
{
if (spriteRenderer == null)
@ -69,6 +71,8 @@ namespace Fungus.Commands
return new Color32(221, 184, 169, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("visible")] public bool visibleOLD;

4
Assets/Fungus/Scripts/Commands/SpawnObject.cs

@ -29,6 +29,8 @@ namespace Fungus.Commands
[Tooltip("Local rotation of newly spawned object.")]
[SerializeField] protected Vector3Data _spawnRotation;
#region Public members
public override void OnEnter()
{
if (_sourceObject.Value == null)
@ -64,6 +66,8 @@ namespace Fungus.Commands
return new Color32(235, 191, 217, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("sourceObject")] public GameObject sourceObjectOLD;

4
Assets/Fungus/Scripts/Commands/StartSwipe.cs

@ -29,6 +29,8 @@ namespace Fungus.Commands
[Tooltip("Camera to use for the pan. Will use main camera if set to none.")]
[SerializeField] protected Camera targetCamera;
#region Public members
public virtual void Start()
{
if (targetCamera == null)
@ -75,5 +77,7 @@ namespace Fungus.Commands
{
return new Color32(216, 228, 170, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/Stop.cs

@ -14,6 +14,8 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class Stop : Command
{
#region Public members
public override void OnEnter()
{
StopParentBlock();
@ -23,5 +25,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/StopBlock.cs

@ -20,6 +20,8 @@ namespace Fungus.Commands
[Tooltip("Name of the Block to stop")]
[SerializeField] protected StringData blockName = new StringData("");
#region Public members
public override void OnEnter()
{
if (blockName.Value == "")
@ -53,5 +55,7 @@ namespace Fungus.Commands
{
return new Color32(253, 253, 150, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/StopFlowchart.cs

@ -21,6 +21,8 @@ namespace Fungus.Commands
[Tooltip("Stop all executing Blocks in a list of target Flowcharts")]
[SerializeField] protected List<Flowchart> targetFlowcharts = new List<Flowchart>();
#region Public members
public override void OnEnter()
{
var flowchart = GetFlowchart();
@ -56,5 +58,7 @@ namespace Fungus.Commands
{
return new Color32(235, 191, 217, 255);
}
#endregion
}
}

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

@ -14,6 +14,8 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class StopMusic : Command
{
#region Public members
public override void OnEnter()
{
var musicController = MusicController.GetInstance();
@ -29,5 +31,7 @@ namespace Fungus.Commands
{
return new Color32(242, 209, 176, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/StopSwipe.cs

@ -14,6 +14,8 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class StopSwipe : Command
{
#region Public members
public override void OnEnter()
{
var cameraController = CameraController.GetInstance();
@ -27,5 +29,7 @@ namespace Fungus.Commands
{
return new Color32(216, 228, 170, 255);
}
#endregion
}
}

4
Assets/Fungus/Scripts/Commands/StopTween.cs

@ -20,12 +20,16 @@ namespace Fungus.Commands
[Tooltip("Stop and destroy any Tweens in current scene with the supplied name")]
[SerializeField] protected StringData _tweenName;
#region Public members
public override void OnEnter()
{
iTween.StopByName(_tweenName.Value);
Continue();
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("tweenName")] public string tweenNameOLD = "";

4
Assets/Fungus/Scripts/Commands/StopTweens.cs

@ -14,10 +14,14 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class StopTweens : Command
{
#region Public members
public override void OnEnter()
{
iTween.Stop();
Continue();
}
#endregion
}
}

46
Assets/Fungus/Scripts/Commands/TweenUI.cs

@ -25,22 +25,6 @@ namespace Fungus.Commands
[Tooltip("Time for the tween to complete")]
[SerializeField] protected FloatData duration = new FloatData(1f);
public override void OnEnter()
{
if (targetObjects.Count == 0)
{
Continue();
return;
}
ApplyTween();
if (!waitUntilFinished)
{
Continue();
}
}
protected virtual void ApplyTween()
{
foreach (GameObject targetObject in targetObjects)
@ -66,18 +50,36 @@ namespace Fungus.Commands
Continue();
}
public override void OnCommandAdded(Block parentBlock)
protected virtual string GetSummaryValue()
{
return "";
}
#region Public members
public override void OnEnter()
{
// Add an empty slot by default. Saves an unnecessary user click.
if (targetObjects.Count == 0)
{
targetObjects.Add(null);
Continue();
return;
}
ApplyTween();
if (!waitUntilFinished)
{
Continue();
}
}
protected virtual string GetSummaryValue()
public override void OnCommandAdded(Block parentBlock)
{
return "";
// Add an empty slot by default. Saves an unnecessary user click.
if (targetObjects.Count == 0)
{
targetObjects.Add(null);
}
}
public override string GetSummary()
@ -130,5 +132,7 @@ namespace Fungus.Commands
return false;
}
#endregion
}
}

12
Assets/Fungus/Scripts/Commands/Wait.cs

@ -20,14 +20,16 @@ namespace Fungus.Commands
[Tooltip("Duration to wait for")]
[SerializeField] protected FloatData _duration = new FloatData(1);
public override void OnEnter()
protected virtual void OnWaitComplete()
{
Invoke ("OnWaitComplete", _duration.Value);
Continue();
}
void OnWaitComplete()
#region Public members
public override void OnEnter()
{
Continue();
Invoke ("OnWaitComplete", _duration.Value);
}
public override string GetSummary()
@ -40,6 +42,8 @@ namespace Fungus.Commands
return new Color32(235, 191, 217, 255);
}
#endregion
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD;

4
Assets/Fungus/Scripts/Commands/While.cs

@ -14,6 +14,8 @@ namespace Fungus.Commands
[AddComponentMenu("")]
public class While : If
{
#region Public members
public override void OnEnter()
{
bool execute = true;
@ -58,5 +60,7 @@ namespace Fungus.Commands
{
return new Color32(253, 253, 150, 255);
}
#endregion
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save