Browse Source

Merge pull request #396 from FungusGames/variable-properties

Command properties use variables
master
Chris Gregan 9 years ago
parent
commit
caef972460
  1. 40
      Assets/Fungus/Animation/Scripts/Commands/ResetAnimTrigger.cs
  2. 40
      Assets/Fungus/Animation/Scripts/Commands/SetAnimBool.cs
  3. 40
      Assets/Fungus/Animation/Scripts/Commands/SetAnimFloat.cs
  4. 40
      Assets/Fungus/Animation/Scripts/Commands/SetAnimInteger.cs
  5. 40
      Assets/Fungus/Animation/Scripts/Commands/SetAnimTrigger.cs
  6. 2
      Assets/Fungus/Audio/Editor/ControlAudioEditor.cs
  7. 78
      Assets/Fungus/Audio/Scripts/Commands/ControlAudio.cs
  8. 33
      Assets/Fungus/Audio/Scripts/Commands/PlayUsfxrSound.cs
  9. 7
      Assets/Fungus/Flowchart/Editor/FlowchartMenuItems.cs
  10. 14
      Assets/Fungus/Flowchart/Editor/VariableEditor.cs
  11. 31
      Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs
  12. 39
      Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs
  13. 6
      Assets/Fungus/Flowchart/Scripts/Commands/OpenURL.cs
  14. 31
      Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs
  15. 33
      Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs
  16. 63
      Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs
  17. 28
      Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs
  18. 65
      Assets/Fungus/Flowchart/Scripts/Flowchart.cs
  19. 51
      Assets/Fungus/Flowchart/Scripts/VariableTypes/AnimatorVariable.cs
  20. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/AnimatorVariable.cs.meta
  21. 51
      Assets/Fungus/Flowchart/Scripts/VariableTypes/AudioSourceVariable.cs
  22. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/AudioSourceVariable.cs.meta
  23. 51
      Assets/Fungus/Flowchart/Scripts/VariableTypes/TransformVariable.cs
  24. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/TransformVariable.cs.meta
  25. 2
      Assets/Fungus/Narrative/Editor/MenuTimerEditor.cs
  26. 26
      Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs
  27. 29
      Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs
  28. 35
      Assets/Fungus/Sprite/Scripts/Commands/FadeSprite.cs
  29. 30
      Assets/Fungus/Sprite/Scripts/Commands/ShowSprite.cs
  30. 48
      Assets/Fungus/iTween/Scripts/Commands/LookFrom.cs
  31. 48
      Assets/Fungus/iTween/Scripts/Commands/LookTo.cs
  32. 33
      Assets/Fungus/iTween/Scripts/Commands/MoveAdd.cs
  33. 48
      Assets/Fungus/iTween/Scripts/Commands/MoveFrom.cs
  34. 48
      Assets/Fungus/iTween/Scripts/Commands/MoveTo.cs
  35. 33
      Assets/Fungus/iTween/Scripts/Commands/PunchPosition.cs
  36. 33
      Assets/Fungus/iTween/Scripts/Commands/PunchRotation.cs
  37. 33
      Assets/Fungus/iTween/Scripts/Commands/PunchScale.cs
  38. 33
      Assets/Fungus/iTween/Scripts/Commands/RotateAdd.cs
  39. 48
      Assets/Fungus/iTween/Scripts/Commands/RotateFrom.cs
  40. 48
      Assets/Fungus/iTween/Scripts/Commands/RotateTo.cs
  41. 33
      Assets/Fungus/iTween/Scripts/Commands/ScaleAdd.cs
  42. 48
      Assets/Fungus/iTween/Scripts/Commands/ScaleFrom.cs
  43. 48
      Assets/Fungus/iTween/Scripts/Commands/ScaleTo.cs
  44. 35
      Assets/Fungus/iTween/Scripts/Commands/ShakePosition.cs
  45. 35
      Assets/Fungus/iTween/Scripts/Commands/ShakeRotation.cs
  46. 35
      Assets/Fungus/iTween/Scripts/Commands/ShakeScale.cs
  47. 25
      Assets/Fungus/iTween/Scripts/Commands/StopTween.cs
  48. 2
      Assets/Fungus/iTween/Scripts/Commands/StopTweens.cs
  49. 46
      Assets/Fungus/iTween/Scripts/Commands/iTweenCommand.cs
  50. 195
      Assets/FungusExamples/TheFacility/TheFacility.unity
  51. 533
      Assets/FungusExamples/iTween/iTween.unity
  52. 2
      ProjectSettings/ProjectVersion.txt

40
Assets/Fungus/Animation/Scripts/Commands/ResetAnimTrigger.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
@ -8,19 +9,19 @@ namespace Fungus
"Reset Anim Trigger",
"Resets a trigger parameter on an Animator component.")]
[AddComponentMenu("")]
public class ResetAnimTrigger : Command
public class ResetAnimTrigger : Command, ISerializationCallbackReceiver
{
[Tooltip("Reference to an Animator component in a game object")]
public Animator animator;
public AnimatorData _animator;
[Tooltip("Name of the trigger Animator parameter that will be reset")]
public string parameterName;
public StringData _parameterName;
public override void OnEnter()
{
if (animator != null)
if (_animator.Value != null)
{
animator.ResetTrigger(parameterName);
_animator.Value.ResetTrigger(_parameterName);
}
Continue();
@ -28,18 +29,43 @@ namespace Fungus
public override string GetSummary()
{
if (animator == null)
if (_animator.Value == null)
{
return "Error: No animator selected";
}
return animator.name + " (" + parameterName + ")";
return _animator.Value.name + " (" + _parameterName + ")";
}
public override Color GetButtonColor()
{
return new Color32(170, 204, 169, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD;
[HideInInspector] [FormerlySerializedAs("parameterName")] public string parameterNameOLD;
public void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
{
if (animatorOLD != null)
{
_animator.Value = animatorOLD;
animatorOLD = null;
}
if (parameterNameOLD != null)
{
_parameterName.Value = parameterNameOLD;
parameterNameOLD = null;
}
}
#endregion
}
}

40
Assets/Fungus/Animation/Scripts/Commands/SetAnimBool.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
@ -8,22 +9,22 @@ namespace Fungus
"Set Anim Bool",
"Sets a boolean parameter on an Animator component to control a Unity animation")]
[AddComponentMenu("")]
public class SetAnimBool : Command
public class SetAnimBool : Command, ISerializationCallbackReceiver
{
[Tooltip("Reference to an Animator component in a game object")]
public Animator animator;
public AnimatorData _animator;
[Tooltip("Name of the boolean Animator parameter that will have its value changed")]
public string parameterName;
public StringData _parameterName;
[Tooltip("The boolean value to set the parameter to")]
public BooleanData value;
public override void OnEnter()
{
if (animator != null)
if (_animator.Value != null)
{
animator.SetBool(parameterName, value.Value);
_animator.Value.SetBool(_parameterName, value.Value);
}
Continue();
@ -31,18 +32,43 @@ namespace Fungus
public override string GetSummary()
{
if (animator == null)
if (_animator.Value == null)
{
return "Error: No animator selected";
}
return animator.name + " (" + parameterName + ")";
return _animator.Value.name + " (" + _parameterName + ")";
}
public override Color GetButtonColor()
{
return new Color32(170, 204, 169, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD;
[HideInInspector] [FormerlySerializedAs("parameterName")] public string parameterNameOLD;
public void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
{
if (animatorOLD != null)
{
_animator.Value = animatorOLD;
animatorOLD = null;
}
if (parameterNameOLD != null)
{
_parameterName.Value = parameterNameOLD;
parameterNameOLD = null;
}
}
#endregion
}
}

40
Assets/Fungus/Animation/Scripts/Commands/SetAnimFloat.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
@ -8,22 +9,22 @@ namespace Fungus
"Set Anim Float",
"Sets a float parameter on an Animator component to control a Unity animation")]
[AddComponentMenu("")]
public class SetAnimFloat : Command
public class SetAnimFloat : Command, ISerializationCallbackReceiver
{
[Tooltip("Reference to an Animator component in a game object")]
public Animator animator;
public AnimatorData _animator;
[Tooltip("Name of the float Animator parameter that will have its value changed")]
public string parameterName;
public StringData _parameterName;
[Tooltip("The float value to set the parameter to")]
public FloatData value;
public override void OnEnter()
{
if (animator != null)
if (_animator.Value != null)
{
animator.SetFloat(parameterName, value.Value);
_animator.Value.SetFloat(_parameterName.Value, value.Value);
}
Continue();
@ -31,18 +32,43 @@ namespace Fungus
public override string GetSummary()
{
if (animator == null)
if (_animator.Value == null)
{
return "Error: No animator selected";
}
return animator.name + " (" + parameterName + ")";
return _animator.Value.name + " (" + _parameterName.Value + ")";
}
public override Color GetButtonColor()
{
return new Color32(170, 204, 169, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD;
[HideInInspector] [FormerlySerializedAs("parameterName")] public string parameterNameOLD;
public void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
{
if (animatorOLD != null)
{
_animator.Value = animatorOLD;
animatorOLD = null;
}
if (parameterNameOLD != null)
{
_parameterName.Value = parameterNameOLD;
parameterNameOLD = null;
}
}
#endregion
}
}

40
Assets/Fungus/Animation/Scripts/Commands/SetAnimInteger.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
@ -8,22 +9,22 @@ namespace Fungus
"Set Anim Integer",
"Sets an integer parameter on an Animator component to control a Unity animation")]
[AddComponentMenu("")]
public class SetAnimInteger : Command
public class SetAnimInteger : Command, ISerializationCallbackReceiver
{
[Tooltip("Reference to an Animator component in a game object")]
public Animator animator;
public AnimatorData _animator;
[Tooltip("Name of the integer Animator parameter that will have its value changed")]
public string parameterName;
public StringData _parameterName;
[Tooltip("The integer value to set the parameter to")]
public IntegerData value;
public override void OnEnter()
{
if (animator != null)
if (_animator.Value != null)
{
animator.SetInteger(parameterName, value.Value);
_animator.Value.SetInteger(_parameterName.Value, value.Value);
}
Continue();
@ -31,18 +32,43 @@ namespace Fungus
public override string GetSummary()
{
if (animator == null)
if (_animator.Value == null)
{
return "Error: No animator selected";
}
return animator.name + " (" + parameterName + ")";
return _animator.Value.name + " (" + _parameterName.Value + ")";
}
public override Color GetButtonColor()
{
return new Color32(170, 204, 169, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD;
[HideInInspector] [FormerlySerializedAs("parameterName")] public string parameterNameOLD;
public void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
{
if (animatorOLD != null)
{
_animator.Value = animatorOLD;
animatorOLD = null;
}
if (parameterNameOLD != null)
{
_parameterName.Value = parameterNameOLD;
parameterNameOLD = null;
}
}
#endregion
}
}

40
Assets/Fungus/Animation/Scripts/Commands/SetAnimTrigger.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
@ -8,19 +9,19 @@ namespace Fungus
"Set Anim Trigger",
"Sets a trigger parameter on an Animator component to control a Unity animation")]
[AddComponentMenu("")]
public class SetAnimTrigger : Command
public class SetAnimTrigger : Command, ISerializationCallbackReceiver
{
[Tooltip("Reference to an Animator component in a game object")]
public Animator animator;
public AnimatorData _animator;
[Tooltip("Name of the trigger Animator parameter that will have its value changed")]
public string parameterName;
public StringData _parameterName;
public override void OnEnter()
{
if (animator != null)
if (_animator.Value != null)
{
animator.SetTrigger(parameterName);
_animator.Value.SetTrigger(_parameterName.Value);
}
Continue();
@ -28,18 +29,43 @@ namespace Fungus
public override string GetSummary()
{
if (animator == null)
if (_animator.Value == null)
{
return "Error: No animator selected";
}
return animator.name + " (" + parameterName + ")";
return _animator.Value.name + " (" + _parameterName.Value + ")";
}
public override Color GetButtonColor()
{
return new Color32(170, 204, 169, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD;
[HideInInspector] [FormerlySerializedAs("parameterName")] public string parameterNameOLD;
public void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
{
if (animatorOLD != null)
{
_animator.Value = animatorOLD;
animatorOLD = null;
}
if (parameterNameOLD != null)
{
_parameterName.Value = parameterNameOLD;
parameterNameOLD = null;
}
}
#endregion
}
}

2
Assets/Fungus/Audio/Editor/ControlAudioEditor.cs

@ -28,7 +28,7 @@ namespace Fungus
return;
controlProp = serializedObject.FindProperty("control");
audioSourceProp = serializedObject.FindProperty("audioSource");
audioSourceProp = serializedObject.FindProperty("_audioSource");
startVolumeProp = serializedObject.FindProperty("startVolume");
endVolumeProp = serializedObject.FindProperty("endVolume");
fadeDurationProp = serializedObject.FindProperty("fadeDuration");

78
Assets/Fungus/Audio/Scripts/Commands/ControlAudio.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -6,7 +7,7 @@ namespace Fungus
[CommandInfo("Audio",
"Control Audio",
"Plays, loops, or stops an audiosource. Any AudioSources with the same tag as the target Audio Source will automatically be stoped.")]
public class ControlAudio : Command
public class ControlAudio : Command, ISerializationCallbackReceiver
{
public enum controlType
{
@ -21,7 +22,7 @@ namespace Fungus
public controlType control;
[Tooltip("Audio clip to play")]
public AudioSource audioSource;
public AudioSourceData _audioSource;
[Range(0,1)]
[Tooltip("Start audio at this volume")]
@ -39,13 +40,13 @@ namespace Fungus
public override void OnEnter()
{
if (audioSource == null)
if (_audioSource.Value == null)
{
Continue();
return;
}
audioSource.volume = endVolume;
_audioSource.Value.volume = endVolume;
switch(control)
{
case controlType.PlayOnce:
@ -60,7 +61,7 @@ namespace Fungus
PauseLoop();
break;
case controlType.StopLoop:
StopLoop(audioSource);
StopLoop(_audioSource.Value);
break;
case controlType.ChangeVolume:
ChangeVolume();
@ -79,7 +80,8 @@ namespace Fungus
protected void StopAudioWithSameTag()
{
// Don't stop audio if there's no tag assigned
if (audioSource.tag == "Untagged")
if (_audioSource.Value == null ||
_audioSource.Value.tag == "Untagged")
{
return;
}
@ -87,7 +89,7 @@ namespace Fungus
AudioSource[] audioSources = GameObject.FindObjectsOfType<AudioSource>();
foreach (AudioSource a in audioSources)
{
if ((a.GetComponent<AudioSource>() != audioSource) && (a.tag == audioSource.tag))
if ((a.GetComponent<AudioSource>() != _audioSource.Value) && (a.tag == _audioSource.Value.tag))
{
StopLoop(a.GetComponent<AudioSource>());
}
@ -99,17 +101,17 @@ namespace Fungus
if (fadeDuration > 0)
{
// Fade volume in
LeanTween.value(audioSource.gameObject,
audioSource.volume,
LeanTween.value(_audioSource.Value.gameObject,
_audioSource.Value.volume,
endVolume,
fadeDuration
).setOnUpdate(
(float updateVolume)=>{
audioSource.volume = updateVolume;
_audioSource.Value.volume = updateVolume;
});
}
audioSource.PlayOneShot(audioSource.clip);
_audioSource.Value.PlayOneShot(_audioSource.Value.clip);
if (waitUntilFinished)
{
@ -121,7 +123,7 @@ namespace Fungus
{
// Poll the audiosource until playing has finished
// This allows for things like effects added to the audiosource.
while (audioSource.isPlaying)
while (_audioSource.Value.isPlaying)
{
yield return null;
}
@ -133,13 +135,13 @@ namespace Fungus
{
if (fadeDuration > 0)
{
audioSource.volume = 0;
audioSource.loop = true;
audioSource.GetComponent<AudioSource>().Play();
LeanTween.value(audioSource.gameObject,0,endVolume,fadeDuration
_audioSource.Value.volume = 0;
_audioSource.Value.loop = true;
_audioSource.Value.GetComponent<AudioSource>().Play();
LeanTween.value(_audioSource.Value.gameObject,0,endVolume,fadeDuration
).setOnUpdate(
(float updateVolume)=>{
audioSource.volume = updateVolume;
_audioSource.Value.volume = updateVolume;
}
).setOnComplete(
()=>{
@ -152,9 +154,9 @@ namespace Fungus
}
else
{
audioSource.volume = 1;
audioSource.loop = true;
audioSource.GetComponent<AudioSource>().Play();
_audioSource.Value.volume = 1;
_audioSource.Value.loop = true;
_audioSource.Value.GetComponent<AudioSource>().Play();
}
}
@ -162,15 +164,15 @@ namespace Fungus
{
if (fadeDuration > 0)
{
LeanTween.value(audioSource.gameObject,audioSource.volume,0,fadeDuration
LeanTween.value(_audioSource.Value.gameObject,_audioSource.Value.volume,0,fadeDuration
).setOnUpdate(
(float updateVolume)=>{
audioSource.volume = updateVolume;
_audioSource.Value.volume = updateVolume;
}
).setOnComplete(
()=>{
audioSource.GetComponent<AudioSource>().Pause();
_audioSource.Value.GetComponent<AudioSource>().Pause();
if (waitUntilFinished)
{
Continue();
@ -180,7 +182,7 @@ namespace Fungus
}
else
{
audioSource.GetComponent<AudioSource>().Pause();
_audioSource.Value.GetComponent<AudioSource>().Pause();
}
}
@ -188,7 +190,7 @@ namespace Fungus
{
if (fadeDuration > 0)
{
LeanTween.value(source.gameObject,audioSource.volume,0,fadeDuration
LeanTween.value(source.gameObject,_audioSource.Value.volume,0,fadeDuration
).setOnUpdate(
(float updateVolume)=>{
source.volume = updateVolume;
@ -212,10 +214,10 @@ namespace Fungus
protected void ChangeVolume()
{
LeanTween.value(audioSource.gameObject,audioSource.volume,endVolume,fadeDuration
LeanTween.value(_audioSource.Value.gameObject,_audioSource.Value.volume,endVolume,fadeDuration
).setOnUpdate(
(float updateVolume)=>{
audioSource.volume = updateVolume;
_audioSource.Value.volume = updateVolume;
}
);
}
@ -230,7 +232,7 @@ namespace Fungus
public override string GetSummary()
{
if (audioSource == null)
if (_audioSource.Value == null)
{
return "Error: No sound clip selected";
}
@ -248,13 +250,31 @@ namespace Fungus
}
fadeType += " over " + fadeDuration + " seconds.";
}
return control.ToString() + " \"" + audioSource.name + "\"" + fadeType;
return control.ToString() + " \"" + _audioSource.Value.name + "\"" + fadeType;
}
public override Color GetButtonColor()
{
return new Color32(242, 209, 176, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("audioSource")] public AudioSource audioSourceOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (audioSourceOLD != null)
{
_audioSource.Value = audioSourceOLD;
audioSourceOLD = null;
}
}
#endregion
}
}

33
Assets/Fungus/Audio/Scripts/Commands/PlayUsfxrSound.cs

@ -1,12 +1,13 @@
namespace Fungus {
using System;
using UnityEngine;
using UnityEngine.Serialization;
[CommandInfo("Audio",
"Play Usfxr Sound",
"Plays a usfxr synth sound. Use the usfxr editor [Tools > Fungus > Utilities > Generate usfxr Sound Effects] to create the SettingsString. Set a ParentTransform if using positional sound. See https://github.com/zeh/usfxr for more information about usfxr.")]
[AddComponentMenu("")]
public class PlayUsfxrSound : Command
public class PlayUsfxrSound : Command, ISerializationCallbackReceiver
{
protected SfxrSynth _synth = new SfxrSynth();
@ -14,15 +15,15 @@
public Transform ParentTransform = null;
[Tooltip("Settings string which describes the audio")]
public String SettingsString = "";
public StringData _SettingsString = new StringData("");
[Tooltip("Time to wait before executing the next command")]
public float waitDuration = 0;
//Call this if the settings have changed
protected void UpdateCache() {
if (SettingsString != null) {
_synth.parameters.SetSettingsString(SettingsString);
if (_SettingsString.Value != null) {
_synth.parameters.SetSettingsString(_SettingsString.Value);
_synth.CacheSound();
}
}
@ -51,17 +52,35 @@
}
public override string GetSummary() {
if (String.IsNullOrEmpty(SettingsString)) {
if (String.IsNullOrEmpty(_SettingsString.Value)) {
return "Settings String hasn't been set!";
}
if (ParentTransform != null) {
return "" + ParentTransform.name + ": " + SettingsString;
return "" + ParentTransform.name + ": " + _SettingsString.Value;
}
return "Camera.main: " + SettingsString;
return "Camera.main: " + _SettingsString.Value;
}
public override Color GetButtonColor() {
return new Color32(128, 200, 200, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("SettingsString")] public String SettingsStringOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (SettingsStringOLD != "")
{
_SettingsString.Value = SettingsStringOLD;
SettingsStringOLD = "";
}
}
#endregion
}
}

7
Assets/Fungus/Flowchart/Editor/FlowchartMenuItems.cs

@ -14,6 +14,13 @@ namespace Fungus
GameObject go = SpawnPrefab("Flowchart");
go.transform.position = Vector3.zero;
// This is the latest version of Flowchart, so no need to update.
Flowchart flowchart = go.GetComponent<Flowchart>();
if (flowchart != null)
{
flowchart.version = Flowchart.CURRENT_VERSION;
}
// Only the first created Flowchart in the scene should have a default GameStarted block
if (GameObject.FindObjectsOfType<Flowchart>().Length > 1)
{

14
Assets/Fungus/Flowchart/Editor/VariableEditor.cs

@ -209,7 +209,7 @@ namespace Fungus
protected virtual void DrawSingleLineProperty(Rect rect, GUIContent label, SerializedProperty referenceProp, SerializedProperty valueProp, Flowchart flowchart)
{
const int popupWidth = 100;
const int popupWidth = 17;
Rect controlRect = EditorGUI.PrefixLabel(rect, label);
Rect valueRect = controlRect;
@ -319,4 +319,16 @@ namespace Fungus
[CustomPropertyDrawer (typeof(ObjectData))]
public class ObjectDataDrawer : VariableDataDrawer<ObjectVariable>
{}
[CustomPropertyDrawer (typeof(AnimatorData))]
public class AnimatorDataDrawer : VariableDataDrawer<AnimatorVariable>
{}
[CustomPropertyDrawer (typeof(TransformData))]
public class TransformDataDrawer : VariableDataDrawer<TransformVariable>
{}
[CustomPropertyDrawer (typeof(AudioSourceData))]
public class AudioSourceDrawer : VariableDataDrawer<AudioSourceVariable>
{}
}

31
Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
using System.Collections.Generic;
@ -8,16 +9,16 @@ namespace Fungus
"Destroy",
"Destroys a specified game object in the scene.")]
[AddComponentMenu("")]
public class Destroy : Command
public class Destroy : Command, ISerializationCallbackReceiver
{
[Tooltip("Reference to game object to destroy")]
public GameObject targetGameObject;
public GameObjectData _targetGameObject;
public override void OnEnter()
{
if (targetGameObject != null)
if (_targetGameObject.Value != null)
{
Destroy(targetGameObject);
Destroy(_targetGameObject.Value);
}
Continue();
@ -25,18 +26,36 @@ namespace Fungus
public override string GetSummary()
{
if (targetGameObject == null)
if (_targetGameObject.Value == null)
{
return "Error: No game object selected";
}
return targetGameObject.name;
return _targetGameObject.Value.name;
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("targetGameObject")] public GameObject targetGameObjectOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (targetGameObjectOLD != null)
{
_targetGameObject.Value = targetGameObjectOLD;
targetGameObjectOLD = null;
}
}
#endregion
}
}

39
Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs

@ -1,43 +1,62 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
namespace Fungus
{
[CommandInfo("Flow",
"Load Scene",
"Loads a new Unity scene and displays an optional loading image. This is useful " +
"for splitting a large game across multiple scene files to reduce peak memory " +
"usage. Previously loaded assets will be released before loading the scene to free up memory." +
"The scene to be loaded must be added to the scene list in Build Settings.")]
"Load Scene",
"Loads a new Unity scene and displays an optional loading image. This is useful " +
"for splitting a large game across multiple scene files to reduce peak memory " +
"usage. Previously loaded assets will be released before loading the scene to free up memory." +
"The scene to be loaded must be added to the scene list in Build Settings.")]
[AddComponentMenu("")]
public class LoadScene : Command
public class LoadScene : Command, ISerializationCallbackReceiver
{
[Tooltip("Name of the scene to load. The scene must also be added to the build settings.")]
public string sceneName = "";
public StringData _sceneName = new StringData("");
[Tooltip("Image to display while loading the scene")]
public Texture2D loadingImage;
public override void OnEnter()
{
SceneLoader.LoadScene(sceneName, loadingImage);
SceneLoader.LoadScene(_sceneName.Value, loadingImage);
}
public override string GetSummary()
{
if (sceneName.Length == 0)
if (_sceneName.Value.Length == 0)
{
return "Error: No scene name selected";
}
return sceneName;
return _sceneName;
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("sceneName")] public string sceneNameOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (sceneNameOLD != "")
{
_sceneName.Value = sceneNameOLD;
sceneNameOLD = "";
}
}
#endregion
}
}

6
Assets/Fungus/Flowchart/Scripts/Commands/OpenURL.cs

@ -11,18 +11,18 @@ namespace Fungus
public class LinkToWebsite : Command
{
[Tooltip("URL to open in the browser")]
public string url;
public StringData url = new StringData();
public override void OnEnter()
{
Application.OpenURL(url);
Application.OpenURL(url.Value);
Continue();
}
public override string GetSummary()
{
return url;
return url.Value;
}
public override Color GetButtonColor()

31
Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,7 +8,7 @@ namespace Fungus
"Send Message",
"Sends a message to either the owner Flowchart or all Flowcharts in the scene. Blocks can listen for this message using a Message Received event handler.")]
[AddComponentMenu("")]
public class SendMessage : Command
public class SendMessage : Command, ISerializationCallbackReceiver
{
public enum MessageTarget
{
@ -19,11 +20,11 @@ namespace Fungus
public MessageTarget messageTarget;
[Tooltip("Name of the message to send")]
public string message = "";
public StringData _message = new StringData("");
public override void OnEnter()
{
if (message.Length == 0)
if (_message.Value.Length == 0)
{
Continue();
return;
@ -45,7 +46,7 @@ namespace Fungus
{
foreach (MessageReceived receiver in receivers)
{
receiver.OnSendFungusMessage(message);
receiver.OnSendFungusMessage(_message.Value);
}
}
@ -54,18 +55,36 @@ namespace Fungus
public override string GetSummary()
{
if (message.Length == 0)
if (_message.Value.Length == 0)
{
return "Error: No message specified";
}
return message;
return _message.Value;
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("message")] public string messageOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (messageOLD != "")
{
_message.Value = messageOLD;
messageOLD = "";
}
}
#endregion
}
}

33
Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
using System.Collections.Generic;
@ -8,19 +9,19 @@ namespace Fungus
"Set Active",
"Sets a game object in the scene to be active / inactive.")]
[AddComponentMenu("")]
public class SetActive : Command
{
public class SetActive : Command, ISerializationCallbackReceiver
{
[Tooltip("Reference to game object to enable / disable")]
public GameObject targetGameObject;
public GameObjectData _targetGameObject;
[Tooltip("Set to true to enable the game object")]
public BooleanData activeState;
public override void OnEnter()
{
if (targetGameObject != null)
if (_targetGameObject.Value != null)
{
targetGameObject.SetActive(activeState.Value);
_targetGameObject.Value.SetActive(activeState.Value);
}
Continue();
@ -28,18 +29,36 @@ namespace Fungus
public override string GetSummary()
{
if (targetGameObject == null)
if (_targetGameObject.Value == null)
{
return "Error: No game object selected";
}
return targetGameObject.name + " = " + activeState.GetDescription();
return _targetGameObject.Value.name + " = " + activeState.GetDescription();
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("targetGameObject")] public GameObject targetGameObjectOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (targetGameObjectOLD != null)
{
_targetGameObject.Value = targetGameObjectOLD;
targetGameObjectOLD = null;
}
}
#endregion
}
}

63
Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -10,54 +11,90 @@ namespace Fungus
"Spawn Object",
"Spawns a new object based on a reference to a scene or prefab game object.")]
[AddComponentMenu("")]
public class SpawnObject : Command
public class SpawnObject : Command, ISerializationCallbackReceiver
{
[Tooltip("Game object to copy when spawning. Can be a scene object or a prefab.")]
public GameObject sourceObject;
public GameObjectData _sourceObject;
[Tooltip("Transform to use for position of newly spawned object.")]
public Transform parentTransform;
public TransformData _parentTransform;
[Tooltip("Local position of newly spawned object.")]
public Vector3 spawnPosition;
public Vector3Data _spawnPosition;
[Tooltip("Local rotation of newly spawned object.")]
public Vector3 spawnRotation;
public Vector3Data _spawnRotation;
public override void OnEnter()
{
if (sourceObject == null)
if (_sourceObject.Value == null)
{
Continue();
return;
}
GameObject newObject = GameObject.Instantiate(sourceObject);
if (parentTransform != null)
GameObject newObject = GameObject.Instantiate(_sourceObject.Value);
if (_parentTransform.Value != null)
{
newObject.transform.parent = parentTransform;
newObject.transform.parent = _parentTransform.Value;
}
newObject.transform.localPosition = spawnPosition;
newObject.transform.localRotation = Quaternion.Euler(spawnRotation);
newObject.transform.localPosition = _spawnPosition.Value;
newObject.transform.localRotation = Quaternion.Euler(_spawnRotation.Value);
Continue();
}
public override string GetSummary()
{
if (sourceObject == null)
if (_sourceObject.Value == null)
{
return "Error: No source GameObject specified";
}
return sourceObject.name;
return _sourceObject.Value.name;
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("sourceObject")] public GameObject sourceObjectOLD;
[HideInInspector] [FormerlySerializedAs("parentTransform")] public Transform parentTransformOLD;
[HideInInspector] [FormerlySerializedAs("spawnPosition")] public Vector3 spawnPositionOLD;
[HideInInspector] [FormerlySerializedAs("spawnRotation")] public Vector3 spawnRotationOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (sourceObjectOLD != null)
{
_sourceObject.Value = sourceObjectOLD;
sourceObjectOLD = null;
}
if (parentTransformOLD != null)
{
_parentTransform.Value = parentTransformOLD;
parentTransformOLD = null;
}
if (spawnPositionOLD != default(Vector3))
{
_spawnPosition.Value = spawnPositionOLD;
spawnPositionOLD = default(Vector3);
}
if (spawnRotationOLD != default(Vector3))
{
_spawnRotation.Value = spawnRotationOLD;
spawnRotationOLD = default(Vector3);
}
}
#endregion
}
}

28
Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
@ -7,16 +8,15 @@ namespace Fungus
[CommandInfo("Flow",
"Wait",
"Waits for period of time before executing the next command in the block.")]
[AddComponentMenu("")]
public class Wait : Command
public class Wait : Command, ISerializationCallbackReceiver
{
[Tooltip("Duration to wait for")]
public float duration = 1;
public FloatData _duration = new FloatData(1);
public override void OnEnter()
{
Invoke ("OnWaitComplete", duration);
Invoke ("OnWaitComplete", _duration.Value);
}
void OnWaitComplete()
@ -26,13 +26,31 @@ namespace Fungus
public override string GetSummary()
{
return duration.ToString() + " seconds";
return _duration.Value.ToString() + " seconds";
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (durationOLD != default(float))
{
_duration.Value = durationOLD;
durationOLD = default(float);
}
}
#endregion
}
}

65
Assets/Fungus/Flowchart/Scripts/Flowchart.cs

@ -9,6 +9,16 @@ using System.Text.RegularExpressions;
namespace Fungus
{
/**
* Interface for Flowchart components which can be updated when the
* scene loads in the editor. This is used to maintain backwards
* compatibility with earlier versions of Fungus.
*/
interface IUpdateable
{
void UpdateToVersion(int oldVersion, int newVersion);
}
/**
* Visual scripting controller for the Flowchart programming language.
* Flowchart objects may be edited visually using the Flowchart editor window.
@ -16,10 +26,10 @@ namespace Fungus
[ExecuteInEditMode]
public class Flowchart : MonoBehaviour
{
/**
* Current version used to compare with the previous version so older versions can be custom-updated from previous versions.
*/
public const string CURRENT_VERSION = "1.0";
/**
* The current version of the Flowchart. Used for updating components.
*/
public const int CURRENT_VERSION = 1;
/**
* The name of the initial block in a new flowchart.
@ -27,10 +37,10 @@ namespace Fungus
public const string DEFAULT_BLOCK_NAME = "New Block";
/**
* Variable to track flowchart's version and if initial set up has completed.
* Variable to track flowchart's version so components can update to new versions.
*/
[HideInInspector]
public string version;
public int version = 0; // Default to 0 to always trigger an update for older versions of Fungus.
/**
* Scroll position of Flowchart editor window.
@ -209,7 +219,28 @@ namespace Fungus
CheckItemIds();
CleanupComponents();
UpdateVersion();
UpdateVersion();
}
protected virtual void UpdateVersion()
{
if (version == CURRENT_VERSION)
{
// No need to update
return;
}
// Tell all components that implement IUpdateable to update to the new version
foreach (Component component in GetComponents<Component>())
{
IUpdateable u = component as IUpdateable;
if (u != null)
{
u.UpdateToVersion(version, CURRENT_VERSION);
}
}
version = CURRENT_VERSION;
}
public virtual void OnDisable()
@ -302,26 +333,6 @@ namespace Fungus
}
}
private void UpdateVersion()
{
// If versions match, then we are already using the latest.
if (version == CURRENT_VERSION) return;
switch (version)
{
// Version never set, so we are initializing on first creation or this flowchart is pre-versioning.
case null:
case "":
Initialize();
break;
}
version = CURRENT_VERSION;
}
protected virtual void Initialize()
{}
protected virtual Block CreateBlockComponent(GameObject parent)
{
Block block = parent.AddComponent<Block>();

51
Assets/Fungus/Flowchart/Scripts/VariableTypes/AnimatorVariable.cs

@ -0,0 +1,51 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[VariableInfo("Other", "Animator")]
[AddComponentMenu("")]
public class AnimatorVariable : VariableBase<Animator>
{}
[System.Serializable]
public struct AnimatorData
{
[SerializeField]
[VariableProperty("<Value>", typeof(AnimatorVariable))]
public AnimatorVariable animatorRef;
[SerializeField]
public Animator animatorVal;
public AnimatorData(Animator v)
{
animatorVal = v;
animatorRef = null;
}
public static implicit operator Animator(AnimatorData animatorData)
{
return animatorData.Value;
}
public Animator Value
{
get { return (animatorRef == null) ? animatorVal : animatorRef.value; }
set { if (animatorRef == null) { animatorVal = value; } else { animatorRef.value = value; } }
}
public string GetDescription()
{
if (animatorRef == null)
{
return animatorVal.ToString();
}
else
{
return animatorRef.key;
}
}
}
}

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/AnimatorVariable.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8cbd0c93fbe0e46f78685c33d82bcc7b
timeCreated: 1457886300
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

51
Assets/Fungus/Flowchart/Scripts/VariableTypes/AudioSourceVariable.cs

@ -0,0 +1,51 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[VariableInfo("Other", "AudioSource")]
[AddComponentMenu("")]
public class AudioSourceVariable : VariableBase<AudioSource>
{}
[System.Serializable]
public struct AudioSourceData
{
[SerializeField]
[VariableProperty("<Value>", typeof(AudioSourceVariable))]
public AudioSourceVariable audioSourceRef;
[SerializeField]
public AudioSource audioSourceVal;
public AudioSourceData(AudioSource v)
{
audioSourceVal = v;
audioSourceRef = null;
}
public static implicit operator AudioSource(AudioSourceData audioSourceData)
{
return audioSourceData.Value;
}
public AudioSource Value
{
get { return (audioSourceRef == null) ? audioSourceVal : audioSourceRef.value; }
set { if (audioSourceRef == null) { audioSourceVal = value; } else { audioSourceRef.value = value; } }
}
public string GetDescription()
{
if (audioSourceRef == null)
{
return audioSourceVal.ToString();
}
else
{
return audioSourceRef.key;
}
}
}
}

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/AudioSourceVariable.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fe0d9dc5080b040bd8daff067b407916
timeCreated: 1457892188
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

51
Assets/Fungus/Flowchart/Scripts/VariableTypes/TransformVariable.cs

@ -0,0 +1,51 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[VariableInfo("Other", "Transform")]
[AddComponentMenu("")]
public class TransformVariable : VariableBase<Transform>
{}
[System.Serializable]
public struct TransformData
{
[SerializeField]
[VariableProperty("<Value>", typeof(TransformVariable))]
public TransformVariable transformRef;
[SerializeField]
public Transform transformVal;
public TransformData(Transform v)
{
transformVal = v;
transformRef = null;
}
public static implicit operator Transform(TransformData vector3Data)
{
return vector3Data.Value;
}
public Transform Value
{
get { return (transformRef == null) ? transformVal : transformRef.value; }
set { if (transformRef == null) { transformVal = value; } else { transformRef.value = value; } }
}
public string GetDescription()
{
if (transformRef == null)
{
return transformVal.ToString();
}
else
{
return transformRef.key;
}
}
}
}

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/TransformVariable.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 633bea14077b44e19956e8113fbac7a4
timeCreated: 1457893486
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2
Assets/Fungus/Narrative/Editor/MenuTimerEditor.cs

@ -17,7 +17,7 @@ namespace Fungus
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
durationProp = serializedObject.FindProperty("duration");
durationProp = serializedObject.FindProperty("_duration");
targetBlockProp = serializedObject.FindProperty("targetBlock");
}

26
Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs

@ -11,10 +11,10 @@ namespace Fungus
"Menu Timer",
"Displays a timer bar and executes a target block if the player fails to select a menu option in time.")]
[AddComponentMenu("")]
public class MenuTimer : Command
{
public class MenuTimer : Command, ISerializationCallbackReceiver
{
[Tooltip("Length of time to display the timer for")]
public float duration;
public FloatData _duration = new FloatData(1);
[FormerlySerializedAs("targetSequence")]
[Tooltip("Block to execute when the timer expires")]
@ -27,7 +27,7 @@ namespace Fungus
if (menuDialog != null &&
targetBlock != null)
{
menuDialog.ShowTimer(duration, targetBlock);
menuDialog.ShowTimer(_duration.Value, targetBlock);
}
Continue();
@ -55,6 +55,24 @@ namespace Fungus
{
return new Color32(184, 210, 235, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (durationOLD != default(float))
{
_duration.Value = durationOLD;
durationOLD = default(float);
}
}
#endregion
}
}

29
Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,10 +8,10 @@ namespace Fungus
"Set Language",
"Set the active language for the scene. A Localization object with a localization file must be present in the scene.")]
[AddComponentMenu("")]
public class SetLanguage : Command
public class SetLanguage : Command, ISerializationCallbackReceiver
{
[Tooltip("Code of the language to set. e.g. ES, DE, JA")]
public string languageCode;
public StringData _languageCode = new StringData();
public static string mostRecentLanguage = "";
@ -19,11 +20,11 @@ namespace Fungus
Localization localization = GameObject.FindObjectOfType<Localization>();
if (localization != null)
{
localization.SetActiveLanguage(languageCode, true);
localization.SetActiveLanguage(_languageCode.Value, true);
// Cache the most recently set language code so we can continue to
// use the same language in subsequent scenes.
mostRecentLanguage = languageCode;
mostRecentLanguage = _languageCode.Value;
}
Continue();
@ -31,12 +32,30 @@ namespace Fungus
public override string GetSummary()
{
return languageCode;
return _languageCode.Value;
}
public override Color GetButtonColor()
{
return new Color32(184, 210, 235, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("languageCode")] public string languageCodeOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (languageCodeOLD != "")
{
_languageCode.Value = languageCodeOLD;
languageCodeOLD = "";
}
}
#endregion
}
}

35
Assets/Fungus/Sprite/Scripts/Commands/FadeSprite.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
@ -8,16 +9,16 @@ namespace Fungus
"Fade Sprite",
"Fades a sprite to a target color over a period of time.")]
[AddComponentMenu("")]
public class FadeSprite : Command
public class FadeSprite : Command, ISerializationCallbackReceiver
{
[Tooltip("Sprite object to be faded")]
public SpriteRenderer spriteRenderer;
[Tooltip("Length of time to perform the fade")]
public float duration = 1f;
public 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 Color targetColor = Color.white;
public ColorData _targetColor = new ColorData(Color.white);
[Tooltip("Wait until the fade has finished before executing the next command")]
public bool waitUntilFinished = true;
@ -37,7 +38,7 @@ namespace Fungus
cameraController.waiting = true;
}
SpriteFader.FadeSprite(spriteRenderer, targetColor, duration, Vector2.zero, delegate {
SpriteFader.FadeSprite(spriteRenderer, _targetColor.Value, _duration.Value, Vector2.zero, delegate {
if (waitUntilFinished)
{
cameraController.waiting = false;
@ -58,13 +59,37 @@ namespace Fungus
return "Error: No sprite renderer selected";
}
return spriteRenderer.name + " to " + targetColor.ToString();
return spriteRenderer.name + " to " + _targetColor.Value.ToString();
}
public override Color GetButtonColor()
{
return new Color32(221, 184, 169, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD;
[HideInInspector] [FormerlySerializedAs("targetColor")] public Color targetColorOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (durationOLD != default(float))
{
_duration.Value = durationOLD;
durationOLD = default(float);
}
if (targetColorOLD != default(Color))
{
_targetColor.Value = targetColorOLD;
targetColorOLD = default(Color);
}
}
#endregion
}
}

30
Assets/Fungus/Sprite/Scripts/Commands/ShowSprite.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
@ -8,14 +9,15 @@ namespace Fungus
"Show Sprite",
"Makes a sprite visible / invisible by setting the color alpha.")]
[AddComponentMenu("")]
public class ShowSprite : Command
public class ShowSprite : Command, ISerializationCallbackReceiver
{
[Tooltip("Sprite object to be made visible / invisible")]
public SpriteRenderer spriteRenderer;
[Tooltip("Make the sprite visible or invisible")]
public bool visible = true;
public BooleanData _visible = new BooleanData(false);
[Tooltip("Affect the visibility of child sprites")]
public bool affectChildren = true;
public override void OnEnter()
@ -27,12 +29,12 @@ namespace Fungus
SpriteRenderer[] children = spriteRenderer.gameObject.GetComponentsInChildren<SpriteRenderer>();
foreach (SpriteRenderer sr in children)
{
SetSpriteAlpha(sr, visible);
SetSpriteAlpha(sr, _visible.Value);
}
}
else
{
SetSpriteAlpha(spriteRenderer, visible);
SetSpriteAlpha(spriteRenderer, _visible.Value);
}
}
@ -53,13 +55,31 @@ namespace Fungus
return "Error: No sprite renderer selected";
}
return spriteRenderer.name + " to " + (visible ? "visible" : "invisible");
return spriteRenderer.name + " to " + (_visible.Value ? "visible" : "invisible");
}
public override Color GetButtonColor()
{
return new Color32(221, 184, 169, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("visible")] public bool visibleOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (visibleOLD != default(bool))
{
_visible.Value = visibleOLD;
visibleOLD = default(bool);
}
}
#endregion
}
}

48
Assets/Fungus/iTween/Scripts/Commands/LookFrom.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,13 +8,13 @@ namespace Fungus
"Look From",
"Instantly rotates a GameObject to look at the supplied Vector3 then returns it to it's starting rotation over time.")]
[AddComponentMenu("")]
public class LookFrom : iTweenCommand
public class LookFrom : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("Target transform that the GameObject will look at")]
public Transform fromTransform;
public TransformData _fromTransform;
[Tooltip("Target world position that the GameObject will look at, if no From Transform is set")]
public Vector3 fromPosition;
public Vector3Data _fromPosition;
[Tooltip("Restricts rotation to the supplied axis only")]
public iTweenAxis axis;
@ -21,14 +22,14 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
if (fromTransform == null)
tweenParams.Add("name", _tweenName.Value);
if (_fromTransform.Value == null)
{
tweenParams.Add("looktarget", fromPosition);
tweenParams.Add("looktarget", _fromPosition.Value);
}
else
{
tweenParams.Add("looktarget", fromTransform);
tweenParams.Add("looktarget", _fromTransform.Value);
}
switch (axis)
{
@ -42,14 +43,41 @@ namespace Fungus
tweenParams.Add("axis", "z");
break;
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.LookFrom(targetObject, tweenParams);
}
iTween.LookFrom(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD;
[HideInInspector] [FormerlySerializedAs("fromPosition")] public Vector3 fromPositionOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (fromTransformOLD != null)
{
_fromTransform.Value = fromTransformOLD;
fromTransformOLD = null;
}
if (fromPositionOLD != default(Vector3))
{
_fromPosition.Value = fromPositionOLD;
fromPositionOLD = default(Vector3);
}
}
#endregion
}
}

48
Assets/Fungus/iTween/Scripts/Commands/LookTo.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,13 +8,13 @@ namespace Fungus
"Look To",
"Rotates a GameObject to look at a supplied Transform or Vector3 over time.")]
[AddComponentMenu("")]
public class LookTo : iTweenCommand
public class LookTo : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("Target transform that the GameObject will look at")]
public Transform toTransform;
public TransformData _toTransform;
[Tooltip("Target world position that the GameObject will look at, if no From Transform is set")]
public Vector3 toPosition;
public Vector3Data _toPosition;
[Tooltip("Restricts rotation to the supplied axis only")]
public iTweenAxis axis;
@ -21,14 +22,14 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
if (toTransform == null)
tweenParams.Add("name", _tweenName.Value);
if (_toTransform.Value == null)
{
tweenParams.Add("looktarget", toPosition);
tweenParams.Add("looktarget", _toPosition.Value);
}
else
{
tweenParams.Add("looktarget", toTransform);
tweenParams.Add("looktarget", _toTransform.Value);
}
switch (axis)
{
@ -42,14 +43,41 @@ namespace Fungus
tweenParams.Add("axis", "z");
break;
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.LookTo(targetObject, tweenParams);
}
iTween.LookTo(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD;
[HideInInspector] [FormerlySerializedAs("toPosition")] public Vector3 toPositionOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (toTransformOLD != null)
{
_toTransform.Value = toTransformOLD;
toTransformOLD = null;
}
if (toPositionOLD != default(Vector3))
{
_toPosition.Value = toPositionOLD;
toPositionOLD = default(Vector3);
}
}
#endregion
}
}

33
Assets/Fungus/iTween/Scripts/Commands/MoveAdd.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,10 +8,10 @@ namespace Fungus
"Move Add",
"Moves a game object by a specified offset over time.")]
[AddComponentMenu("")]
public class MoveAdd : iTweenCommand
public class MoveAdd : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("A translation offset in space the GameObject will animate to")]
public Vector3 offset;
public Vector3Data _offset;
[Tooltip("Apply the transformation in either the world coordinate or local cordinate system")]
public Space space = Space.Self;
@ -18,17 +19,37 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", offset);
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _offset.Value);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.MoveAdd(targetObject, tweenParams);
iTween.MoveAdd(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("offset")] public Vector3 offsetOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (offsetOLD != default(Vector3))
{
_offset.Value = offsetOLD;
offsetOLD = default(Vector3);
}
}
#endregion
}
}

48
Assets/Fungus/iTween/Scripts/Commands/MoveFrom.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,13 +8,13 @@ namespace Fungus
"Move From",
"Moves a game object from a specified position back to its starting position over time. The position can be defined by a transform in another object (using To Transform) or by setting an absolute position (using To Position, if To Transform is set to None).")]
[AddComponentMenu("")]
public class MoveFrom : iTweenCommand
public class MoveFrom : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("Target transform that the GameObject will move from")]
public Transform fromTransform;
public TransformData _fromTransform;
[Tooltip("Target world position that the GameObject will move from, if no From Transform is set")]
public Vector3 fromPosition;
public Vector3Data _fromPosition;
[Tooltip("Whether to animate in world space or relative to the parent. False by default.")]
public bool isLocal;
@ -21,24 +22,51 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
if (fromTransform == null)
tweenParams.Add("name", _tweenName.Value);
if (_fromTransform.Value == null)
{
tweenParams.Add("position", fromPosition);
tweenParams.Add("position", _fromPosition.Value);
}
else
{
tweenParams.Add("position", fromTransform);
tweenParams.Add("position", _fromTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.MoveFrom(targetObject, tweenParams);
}
iTween.MoveFrom(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD;
[HideInInspector] [FormerlySerializedAs("fromPosition")] public Vector3 fromPositionOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (fromTransformOLD != null)
{
_fromTransform.Value = fromTransformOLD;
fromTransformOLD = null;
}
if (fromPositionOLD != default(Vector3))
{
_fromPosition.Value = fromPositionOLD;
fromPositionOLD = default(Vector3);
}
}
#endregion
}
}

48
Assets/Fungus/iTween/Scripts/Commands/MoveTo.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,13 +8,13 @@ namespace Fungus
"Move To",
"Moves a game object to a specified position over time. The position can be defined by a transform in another object (using To Transform) or by setting an absolute position (using To Position, if To Transform is set to None).")]
[AddComponentMenu("")]
public class MoveTo : iTweenCommand
public class MoveTo : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("Target transform that the GameObject will move to")]
public Transform toTransform;
public TransformData _toTransform;
[Tooltip("Target world position that the GameObject will move to, if no From Transform is set")]
public Vector3 toPosition;
public Vector3Data _toPosition;
[Tooltip("Whether to animate in world space or relative to the parent. False by default.")]
public bool isLocal;
@ -21,24 +22,51 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
if (toTransform == null)
tweenParams.Add("name", _tweenName.Value);
if (_toTransform.Value == null)
{
tweenParams.Add("position", toPosition);
tweenParams.Add("position", _toPosition.Value);
}
else
{
tweenParams.Add("position", toTransform);
tweenParams.Add("position", _toTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.MoveTo(targetObject, tweenParams);
}
iTween.MoveTo(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD;
[HideInInspector] [FormerlySerializedAs("toPosition")] public Vector3 toPositionOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (toTransformOLD != null)
{
_toTransform.Value = toTransformOLD;
toTransformOLD = null;
}
if (toPositionOLD != default(Vector3))
{
_toPosition.Value = toPositionOLD;
toPositionOLD = default(Vector3);
}
}
#endregion
}
}

33
Assets/Fungus/iTween/Scripts/Commands/PunchPosition.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,10 +8,10 @@ namespace Fungus
"Punch Position",
"Applies a jolt of force to a GameObject's position and wobbles it back to its initial position.")]
[AddComponentMenu("")]
public class PunchPosition : iTweenCommand
public class PunchPosition : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("A translation offset in space the GameObject will animate to")]
public Vector3 amount;
public Vector3Data _amount;
[Tooltip("Apply the transformation in either the world coordinate or local cordinate system")]
public Space space = Space.Self;
@ -18,17 +19,37 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", amount);
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.PunchPosition(targetObject, tweenParams);
iTween.PunchPosition(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;
amountOLD = default(Vector3);
}
}
#endregion
}
}

33
Assets/Fungus/iTween/Scripts/Commands/PunchRotation.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,10 +8,10 @@ namespace Fungus
"Punch Rotation",
"Applies a jolt of force to a GameObject's rotation and wobbles it back to its initial rotation.")]
[AddComponentMenu("")]
public class PunchRotation : iTweenCommand
public class PunchRotation : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("A rotation offset in space the GameObject will animate to")]
public Vector3 amount;
public Vector3Data _amount;
[Tooltip("Apply the transformation in either the world coordinate or local cordinate system")]
public Space space = Space.Self;
@ -18,17 +19,37 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", amount);
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.PunchRotation(targetObject, tweenParams);
iTween.PunchRotation(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;
amountOLD = default(Vector3);
}
}
#endregion
}
}

33
Assets/Fungus/iTween/Scripts/Commands/PunchScale.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,24 +8,44 @@ namespace Fungus
"Punch Scale",
"Applies a jolt of force to a GameObject's scale and wobbles it back to its initial scale.")]
[AddComponentMenu("")]
public class PunchScale : iTweenCommand
public class PunchScale : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("A scale offset in space the GameObject will animate to")]
public Vector3 amount;
public Vector3Data _amount;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", amount);
tweenParams.Add("time", duration);
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.PunchScale(targetObject, tweenParams);
iTween.PunchScale(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;
amountOLD = default(Vector3);
}
}
#endregion
}
}

33
Assets/Fungus/iTween/Scripts/Commands/RotateAdd.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,10 +8,10 @@ namespace Fungus
"Rotate Add",
"Rotates a game object by the specified angles over time.")]
[AddComponentMenu("")]
public class RotateAdd : iTweenCommand
public class RotateAdd : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("A rotation offset in space the GameObject will animate to")]
public Vector3 offset;
public Vector3Data _offset;
[Tooltip("Apply the transformation in either the world coordinate or local cordinate system")]
public Space space = Space.Self;
@ -18,17 +19,37 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", offset);
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _offset.Value);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.RotateAdd(targetObject, tweenParams);
iTween.RotateAdd(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("offset")] public Vector3 offsetOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (offsetOLD != default(Vector3))
{
_offset.Value = offsetOLD;
offsetOLD = default(Vector3);
}
}
#endregion
}
}

48
Assets/Fungus/iTween/Scripts/Commands/RotateFrom.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,13 +8,13 @@ namespace Fungus
"Rotate From",
"Rotates a game object from the specified angles back to its starting orientation over time.")]
[AddComponentMenu("")]
public class RotateFrom : iTweenCommand
public class RotateFrom : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("Target transform that the GameObject will rotate from")]
public Transform fromTransform;
public TransformData _fromTransform;
[Tooltip("Target rotation that the GameObject will rotate from, if no From Transform is set")]
public Vector3 fromRotation;
public Vector3Data _fromRotation;
[Tooltip("Whether to animate in world space or relative to the parent. False by default.")]
public bool isLocal;
@ -21,24 +22,51 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
if (fromTransform == null)
tweenParams.Add("name", _tweenName.Value);
if (_fromTransform.Value == null)
{
tweenParams.Add("rotation", fromRotation);
tweenParams.Add("rotation", _fromRotation.Value);
}
else
{
tweenParams.Add("rotation", fromTransform);
tweenParams.Add("rotation", _fromTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.RotateFrom(targetObject, tweenParams);
}
iTween.RotateFrom(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD;
[HideInInspector] [FormerlySerializedAs("fromRotation")] public Vector3 fromRotationOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (fromTransformOLD != null)
{
_fromTransform.Value = fromTransformOLD;
fromTransformOLD = null;
}
if (fromRotationOLD != default(Vector3))
{
_fromRotation.Value = fromRotationOLD;
fromRotationOLD = default(Vector3);
}
}
#endregion
}
}

48
Assets/Fungus/iTween/Scripts/Commands/RotateTo.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,13 +8,13 @@ namespace Fungus
"Rotate To",
"Rotates a game object to the specified angles over time.")]
[AddComponentMenu("")]
public class RotateTo : iTweenCommand
public class RotateTo : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("Target transform that the GameObject will rotate to")]
public Transform toTransform;
public TransformData _toTransform;
[Tooltip("Target rotation that the GameObject will rotate to, if no To Transform is set")]
public Vector3 toRotation;
public Vector3Data _toRotation;
[Tooltip("Whether to animate in world space or relative to the parent. False by default.")]
public bool isLocal;
@ -21,24 +22,51 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
if (toTransform == null)
tweenParams.Add("name", _tweenName.Value);
if (_toTransform.Value == null)
{
tweenParams.Add("rotation", toRotation);
tweenParams.Add("rotation", _toRotation.Value);
}
else
{
tweenParams.Add("rotation", toTransform);
tweenParams.Add("rotation", _toTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.RotateTo(targetObject, tweenParams);
}
iTween.RotateTo(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD;
[HideInInspector] [FormerlySerializedAs("toRotation")] public Vector3 toRotationOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (toTransformOLD != null)
{
_toTransform.Value = toTransformOLD;
toTransformOLD = null;
}
if (toRotationOLD != default(Vector3))
{
_toRotation.Value = toRotationOLD;
toRotationOLD = default(Vector3);
}
}
#endregion
}
}

33
Assets/Fungus/iTween/Scripts/Commands/ScaleAdd.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,24 +8,44 @@ namespace Fungus
"Scale Add",
"Changes a game object's scale by a specified offset over time.")]
[AddComponentMenu("")]
public class ScaleAdd : iTweenCommand
public class ScaleAdd : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("A scale offset in space the GameObject will animate to")]
public Vector3 offset;
public Vector3Data _offset;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", offset);
tweenParams.Add("time", duration);
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _offset.Value);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ScaleAdd(targetObject, tweenParams);
iTween.ScaleAdd(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("offset")] public Vector3 offsetOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (offsetOLD != default(Vector3))
{
_offset.Value = offsetOLD;
offsetOLD = default(Vector3);
}
}
#endregion
}
}

48
Assets/Fungus/iTween/Scripts/Commands/ScaleFrom.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,34 +8,61 @@ namespace Fungus
"Scale From",
"Changes a game object's scale to the specified value and back to its original scale over time.")]
[AddComponentMenu("")]
public class ScaleFrom : iTweenCommand
public class ScaleFrom : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("Target transform that the GameObject will scale from")]
public Transform fromTransform;
public TransformData _fromTransform;
[Tooltip("Target scale that the GameObject will scale from, if no From Transform is set")]
public Vector3 fromScale;
public Vector3Data _fromScale;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
if (fromTransform == null)
tweenParams.Add("name", _tweenName.Value);
if (_fromTransform.Value == null)
{
tweenParams.Add("scale", fromScale);
tweenParams.Add("scale", _fromScale.Value);
}
else
{
tweenParams.Add("scale", fromTransform);
tweenParams.Add("scale", _fromTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ScaleFrom(targetObject, tweenParams);
}
iTween.ScaleFrom(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD;
[HideInInspector] [FormerlySerializedAs("fromScale")] public Vector3 fromScaleOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (fromTransformOLD != null)
{
_fromTransform.Value = fromTransformOLD;
fromTransformOLD = null;
}
if (fromScaleOLD != default(Vector3))
{
_fromScale.Value = fromScaleOLD;
fromScaleOLD = default(Vector3);
}
}
#endregion
}
}

48
Assets/Fungus/iTween/Scripts/Commands/ScaleTo.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,34 +8,61 @@ namespace Fungus
"Scale To",
"Changes a game object's scale to a specified value over time.")]
[AddComponentMenu("")]
public class ScaleTo : iTweenCommand
public class ScaleTo : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("Target transform that the GameObject will scale to")]
public Transform toTransform;
public TransformData _toTransform;
[Tooltip("Target scale that the GameObject will scale to, if no To Transform is set")]
public Vector3 toScale = new Vector3(1f, 1f, 1f);
public Vector3Data _toScale = new Vector3Data(Vector3.one);
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
if (toTransform == null)
tweenParams.Add("name", _tweenName.Value);
if (_toTransform.Value == null)
{
tweenParams.Add("scale", toScale);
tweenParams.Add("scale", _toScale.Value);
}
else
{
tweenParams.Add("scale", toTransform);
tweenParams.Add("scale", _toTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ScaleTo(targetObject, tweenParams);
}
iTween.ScaleTo(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD;
[HideInInspector] [FormerlySerializedAs("toScale")] public Vector3 toScaleOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (toTransformOLD != null)
{
_toTransform.Value = toTransformOLD;
toTransformOLD = null;
}
if (toScaleOLD != default(Vector3))
{
_toScale.Value = toScaleOLD;
toScaleOLD = default(Vector3);
}
}
#endregion
}
}

35
Assets/Fungus/iTween/Scripts/Commands/ShakePosition.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,10 +8,10 @@ namespace Fungus
"Shake Position",
"Randomly shakes a GameObject's position by a diminishing amount over time.")]
[AddComponentMenu("")]
public class ShakePosition : iTweenCommand
public class ShakePosition : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("A translation offset in space the GameObject will animate to")]
public Vector3 amount;
public Vector3Data _amount;
[Tooltip("Whether to animate in world space or relative to the parent. False by default.")]
public bool isLocal;
@ -21,8 +22,8 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", amount);
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
switch (axis)
{
case iTweenAxis.X:
@ -35,15 +36,35 @@ namespace Fungus
tweenParams.Add("axis", "z");
break;
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ShakePosition(targetObject, tweenParams);
}
iTween.ShakePosition(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;
amountOLD = default(Vector3);
}
}
#endregion
}
}

35
Assets/Fungus/iTween/Scripts/Commands/ShakeRotation.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,10 +8,10 @@ namespace Fungus
"Shake Rotation",
"Randomly shakes a GameObject's rotation by a diminishing amount over time.")]
[AddComponentMenu("")]
public class ShakeRotation : iTweenCommand
public class ShakeRotation : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("A rotation offset in space the GameObject will animate to")]
public Vector3 amount;
public Vector3Data _amount;
[Tooltip("Apply the transformation in either the world coordinate or local cordinate system")]
public Space space = Space.Self;
@ -18,17 +19,37 @@ namespace Fungus
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", amount);
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ShakeRotation(targetObject, tweenParams);
}
iTween.ShakeRotation(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;
amountOLD = default(Vector3);
}
}
#endregion
}
}

35
Assets/Fungus/iTween/Scripts/Commands/ShakeScale.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,24 +8,44 @@ namespace Fungus
"Shake Scale",
"Randomly shakes a GameObject's rotation by a diminishing amount over time.")]
[AddComponentMenu("")]
public class ShakeScale : iTweenCommand
public class ShakeScale : iTweenCommand, ISerializationCallbackReceiver
{
[Tooltip("A scale offset in space the GameObject will animate to")]
public Vector3 amount;
public Vector3Data _amount;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", amount);
tweenParams.Add("time", duration);
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ShakeScale(targetObject, tweenParams);
}
iTween.ShakeScale(_targetObject.Value, tweenParams);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD;
public override void OnBeforeSerialize()
{}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;
amountOLD = default(Vector3);
}
}
#endregion
}
}

25
Assets/Fungus/iTween/Scripts/Commands/StopTween.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
@ -7,16 +8,34 @@ namespace Fungus
"Stop Tween",
"Stops an active iTween by name.")]
[AddComponentMenu("")]
public class StopTween : Command
public class StopTween : Command, ISerializationCallbackReceiver
{
[Tooltip("Stop and destroy any Tweens in current scene with the supplied name")]
public string tweenName;
public StringData _tweenName;
public override void OnEnter()
{
iTween.StopByName(tweenName);
iTween.StopByName(_tweenName.Value);
Continue();
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("tweenName")] public string tweenNameOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (tweenNameOLD != "")
{
_tweenName.Value = tweenNameOLD;
tweenNameOLD = "";
}
}
#endregion
}
}

2
Assets/Fungus/iTween/Scripts/Commands/StopTweens.cs

@ -7,7 +7,7 @@ namespace Fungus
"Stop Tweens",
"Stop all active iTweens in the current scene.")]
[AddComponentMenu("")]
public class StopTweens : Command
public class StopTweens : Command
{
public override void OnEnter()
{

46
Assets/Fungus/iTween/Scripts/Commands/iTweenCommand.cs

@ -1,9 +1,10 @@
using UnityEngine;
using System.Collections;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
{
public enum iTweenAxis
{
None,
@ -12,17 +13,16 @@ namespace Fungus
Z
}
public abstract class iTweenCommand : Command
public abstract class iTweenCommand : Command, ISerializationCallbackReceiver
{
[Tooltip("Target game object to apply the Tween to")]
[FormerlySerializedAs("target")]
public GameObject targetObject;
public GameObjectData _targetObject;
[Tooltip("An individual name useful for stopping iTweens by name")]
public string tweenName;
public StringData _tweenName;
[Tooltip("The time in seconds the animation will take to complete")]
public float duration = 1f;
public FloatData _duration = new FloatData(1f);
[Tooltip("The shape of the easing curve applied to the animation")]
public iTween.EaseType easeType = iTween.EaseType.easeInOutQuad;
@ -38,7 +38,7 @@ namespace Fungus
public override void OnEnter()
{
if (targetObject == null)
if (_targetObject.Value == null)
{
Continue();
return;
@ -47,7 +47,7 @@ namespace Fungus
if (stopPreviousTweens)
{
// Force any existing iTweens on this target object to complete immediately
iTween[] tweens = targetObject.GetComponents<iTween>();
iTween[] tweens = _targetObject.Value.GetComponents<iTween>();
foreach (iTween tween in tweens) {
tween.time = 0;
tween.SendMessage("Update");
@ -79,18 +79,44 @@ namespace Fungus
public override string GetSummary()
{
if (targetObject == null)
if (_targetObject.Value == null)
{
return "Error: No target object selected";
}
return targetObject.name + " over " + duration + " seconds";
return _targetObject.Value.name + " over " + _duration.Value + " seconds";
}
public override Color GetButtonColor()
{
return new Color32(233, 163, 180, 255);
}
#region Backwards compatibility
[HideInInspector] [FormerlySerializedAs("target")] [FormerlySerializedAs("targetObject")] public GameObject targetObjectOLD;
[HideInInspector] [FormerlySerializedAs("tweenName")] public string tweenNameOLD;
[HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD;
public virtual void OnBeforeSerialize()
{}
public virtual void OnAfterDeserialize()
{
if (targetObjectOLD != null)
{
_targetObject.Value = targetObjectOLD;
targetObjectOLD = null;
}
if (durationOLD == default(float))
{
_duration.Value = durationOLD;
durationOLD = default(float);
}
}
#endregion
}
}

195
Assets/FungusExamples/TheFacility/TheFacility.unity

@ -8,25 +8,25 @@ SceneSettings:
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: .25
smallestHole: 0.25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_Fog: 0
m_FogColor: {r: .5, g: .5, b: .5, a: 1}
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: .00999999978
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: .5
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
@ -40,7 +40,7 @@ RenderSettings:
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 5
serializedVersion: 6
m_GIWorkflowMode: 1
m_LightmapsMode: 1
m_GISettings:
@ -66,7 +66,7 @@ LightmapSettings:
m_FinalGather: 0
m_FinalGatherRayCount: 1024
m_ReflectionCompression: 2
m_LightmapSnapshot: {fileID: 0}
m_LightingDataAsset: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &5
NavMeshSettings:
@ -74,15 +74,15 @@ NavMeshSettings:
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: .5
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: .400000006
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: .166666657
cellSize: 0.16666666
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &31932611
@ -234,11 +234,11 @@ RectTransform:
m_Children: []
m_Father: {fileID: 31932612}
m_RootOrder: 0
m_AnchorMin: {x: .0907797143, y: .125833333}
m_AnchorMax: {x: .911751449, y: .872500062}
m_AnchorMin: {x: 0.090779714, y: 0.12583333}
m_AnchorMax: {x: 0.91175145, y: 0.87250006}
m_AnchoredPosition: {x: 0, y: -1}
m_SizeDelta: {x: 12, y: -3}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &88347146
MonoBehaviour:
m_ObjectHideFlags: 0
@ -267,6 +267,7 @@ MonoBehaviour:
m_MinSize: 10
m_MaxSize: 50
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -302,7 +303,7 @@ MonoBehaviour:
m_Script: {fileID: -900027084, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: .5}
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 2, y: 2}
m_UseGraphicAlpha: 1
--- !u!222 &88347149
@ -346,7 +347,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &235686027
MonoBehaviour:
m_ObjectHideFlags: 0
@ -360,7 +361,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -375,6 +376,7 @@ MonoBehaviour:
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -428,6 +430,7 @@ MonoBehaviour:
shiftKeyEnabled: 1
nextClickDelay: 0
keyList: 0900000020000000
ignoreMenuClicks: 1
--- !u!224 &243104469
RectTransform:
m_ObjectHideFlags: 0
@ -441,7 +444,7 @@ RectTransform:
m_Children:
- {fileID: 31932612}
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 6
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
@ -488,6 +491,7 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
@ -498,6 +502,7 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
spreadCustomCurve:
serializedVersion: 2
m_Curve:
@ -508,6 +513,7 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
@ -518,6 +524,7 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
--- !u!114 &243104471
MonoBehaviour:
m_ObjectHideFlags: 0
@ -553,10 +560,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
targetTextObject: {fileID: 88347144}
writingSpeed: 60
punctuationPause: .25
punchObject: {fileID: 0}
writingSpeed: 100
punctuationPause: 0.25
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &243104473
MonoBehaviour:
m_ObjectHideFlags: 0
@ -624,8 +634,10 @@ Canvas:
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_SortingLayerID: 0
m_SortingOrder: 1
m_TargetDisplay: 0
--- !u!114 &428153884 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 11400000, guid: e0d427add844a4d9faf970a3afa07583,
@ -671,11 +683,11 @@ MonoBehaviour:
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
@ -754,9 +766,9 @@ RectTransform:
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 1888.90002, y: 212}
m_AnchoredPosition: {x: 1888.9, y: 212}
m_SizeDelta: {x: 123, y: 121}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &552372303
GameObject:
m_ObjectHideFlags: 1
@ -809,14 +821,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3a0bbe22c246e4c78ad8e9816cbae9d5, type: 3}
m_Name:
m_EditorClassIdentifier:
fadeDuration: .25
fadeDuration: 0.25
continueButton: {fileID: 510870838}
dialogCanvas: {fileID: 243104476}
nameText: {fileID: 0}
storyText: {fileID: 88347146}
characterImage: {fileID: 0}
fitTextWithImage: 1
textWidthScale: .800000012
--- !u!1001 &768791691
Prefab:
m_ObjectHideFlags: 0
@ -1001,21 +1012,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1.0
scrollPos: {x: -313.13031, y: 97.234314}
version: 1
scrollPos: {x: -313.1303, y: 97.234314}
variablesScrollPos: {x: 0, y: 0}
variablesExpanded: 1
blockViewHeight: 400
zoom: 1
scrollViewRect:
serializedVersion: 2
x: -1118.14856
y: -610.734985
width: 3324.20264
height: 2227.35059
selectedBlock: {fileID: 771014151}
x: -1118.1486
y: -610.735
width: 3324.2026
height: 2227.3506
selectedBlock: {fileID: 771014104}
selectedCommands:
- {fileID: 771014162}
- {fileID: 771014167}
variables:
- {fileID: 771014103}
description: 'This is a simple Choose Your Own Adventure
@ -1028,6 +1039,7 @@ MonoBehaviour:
hideComponents: 1
saveSelection: 1
localizationId:
hideCommands: []
--- !u!4 &771014101
Transform:
m_ObjectHideFlags: 0
@ -1039,7 +1051,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 2
--- !u!114 &771014102
MonoBehaviour:
m_ObjectHideFlags: 2
@ -1053,8 +1065,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 623.054199
y: -16.7798004
x: 623.0542
y: -16.7798
width: 120
height: 40
itemId: 92
@ -1091,7 +1103,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 471.814453
x: 471.81445
y: -52.946228
width: 120
height: 40
@ -1138,8 +1150,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 780.351135
y: -53.5572128
x: 780.35114
y: -53.557213
width: 128
height: 40
itemId: 83
@ -1210,8 +1222,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 983.054199
y: -53.7798004
x: 983.0542
y: -53.7798
width: 120
height: 40
itemId: 95
@ -1301,7 +1313,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 984.054199
x: 984.0542
y: -116.7798
width: 139
height: 40
@ -1401,7 +1413,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 984.054199
x: 984.0542
y: -183.7798
width: 120
height: 40
@ -1447,8 +1459,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 983.223145
y: 15.7090759
x: 983.22314
y: 15.709076
width: 120
height: 40
itemId: 84
@ -1475,7 +1487,7 @@ MonoBehaviour:
nodeRect:
serializedVersion: 2
x: 1181.0542
y: 75.2201996
y: 75.2202
width: 120
height: 40
itemId: 98
@ -1515,8 +1527,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 1371.35596
y: 36.5333862
x: 1371.356
y: 36.533386
width: 120
height: 40
itemId: 85
@ -1734,8 +1746,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 1369.75391
y: 240.239777
x: 1369.7539
y: 240.23978
width: 124
height: 40
itemId: 103
@ -1961,8 +1973,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 1147.18604
y: 253.534271
x: 1147.186
y: 253.53427
width: 120
height: 40
itemId: 105
@ -1985,8 +1997,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 1368.09448
y: 159.214813
x: 1368.0945
y: 159.21481
width: 120
height: 40
itemId: 86
@ -2065,8 +2077,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 1145.28809
y: 163.344482
x: 1145.2881
y: 163.34448
width: 125
height: 40
itemId: 87
@ -2114,8 +2126,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 940.753906
y: 244.239777
x: 940.7539
y: 244.23978
width: 120
height: 40
itemId: 104
@ -2155,8 +2167,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 935.837646
y: 119.663513
x: 935.83765
y: 119.66351
width: 120
height: 40
itemId: 88
@ -2225,8 +2237,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 746.804199
y: 227.472015
x: 746.8042
y: 227.47202
width: 120
height: 40
itemId: 89
@ -2272,7 +2284,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 740.978638
x: 740.97864
y: 121.01593
width: 130
height: 40
@ -2373,8 +2385,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 737.102661
y: 60.294899
x: 737.10266
y: 60.2949
width: 159
height: 40
itemId: 106
@ -2641,8 +2653,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 625.054199
y: -97.7798004
x: 625.0542
y: -97.7798
width: 120
height: 40
itemId: 91
@ -2957,7 +2969,7 @@ MonoBehaviour:
nodeRect:
serializedVersion: 2
x: 1514.0542
y: -33.7797852
y: -33.779785
width: 120
height: 40
itemId: 99
@ -3143,7 +3155,7 @@ MonoBehaviour:
nodeRect:
serializedVersion: 2
x: 1185.0542
y: 13.2201996
y: 13.2202
width: 120
height: 40
itemId: 97
@ -3274,7 +3286,7 @@ MonoBehaviour:
nodeRect:
serializedVersion: 2
x: 1185.0542
y: -41.7798004
y: -41.7798
width: 120
height: 40
itemId: 96
@ -3446,7 +3458,7 @@ MonoBehaviour:
nodeRect:
serializedVersion: 2
x: 1517.0542
y: 173.220215
y: 173.22021
width: 120
height: 40
itemId: 102
@ -3614,7 +3626,7 @@ MonoBehaviour:
nodeRect:
serializedVersion: 2
x: 1529.0542
y: 36.2202148
y: 36.220215
width: 120
height: 40
itemId: 100
@ -3723,6 +3735,8 @@ MonoBehaviour:
indentLevel: 0
musicClip: {fileID: 8300000, guid: 8f2a44f9988c2445aa82bed59f677134, type: 3}
atTime: 0
loop: 1
fadeDuration: 1
--- !u!114 &771014226
MonoBehaviour:
m_ObjectHideFlags: 2
@ -3737,12 +3751,13 @@ MonoBehaviour:
itemId: 0
errorMessage:
indentLevel: 0
duration: .5
duration: 0.5
fadeOut: 1
targetView: {fileID: 428153884}
waitUntilFinished: 1
fadeColor: {r: 0, g: 0, b: 0, a: 1}
fadeTexture: {fileID: 0}
targetCamera: {fileID: 0}
--- !u!114 &771014228
MonoBehaviour:
m_ObjectHideFlags: 2
@ -3814,8 +3829,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 553.554871
y: 60.0247955
x: 553.5549
y: 60.024796
width: 120
height: 40
itemId: 90
@ -3881,14 +3896,14 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
@ -3904,7 +3919,7 @@ Camera:
m_HDR: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: .0219999999
m_StereoSeparation: 0.022
m_StereoMirrorMode: 0
--- !u!4 &1020378998
Transform:
@ -3913,11 +3928,11 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1020378993}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -19.8929996, y: .701359987, z: -10}
m_LocalPosition: {x: -19.893, y: 0.70136, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_RootOrder: 1
--- !u!1 &1033075835
GameObject:
m_ObjectHideFlags: 0
@ -3964,7 +3979,7 @@ MonoBehaviour:
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: .5
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1033075838
MonoBehaviour:
@ -3991,7 +4006,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
--- !u!1 &1176957117
GameObject:
m_ObjectHideFlags: 0
@ -4026,14 +4041,18 @@ SpriteRenderer:
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 252b5a6bfbbc64f5184461a9150031bf, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
--- !u!4 &1176957119
Transform:
m_ObjectHideFlags: 0
@ -4045,7 +4064,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 4
--- !u!1001 &1660535032
Prefab:
m_ObjectHideFlags: 0

533
Assets/FungusExamples/iTween/iTween.unity

File diff suppressed because it is too large Load Diff

2
ProjectSettings/ProjectVersion.txt

@ -1,2 +1,2 @@
m_EditorVersion: 5.3.2f1
m_EditorVersion: 5.3.4f1
m_StandardAssetsVersion: 0

Loading…
Cancel
Save