Browse Source

Merge pull request #820 from snozbot/feature/variable_null

Change to Show Null for FungusVariables
master
Steve Halliwell 5 years ago committed by GitHub
parent
commit
aad26c9b83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      Assets/Fungus/Scripts/Components/Variable.cs
  2. 2
      Assets/Fungus/Scripts/Utils/AllVariableTypes.cs
  3. 2
      Assets/Fungus/Scripts/VariableTypes/AnimatorVariable.cs
  4. 2
      Assets/Fungus/Scripts/VariableTypes/AudioSourceVariable.cs
  5. 2
      Assets/Fungus/Scripts/VariableTypes/CollectionVariable.cs
  6. 2
      Assets/Fungus/Scripts/VariableTypes/Collider2DVariable.cs
  7. 2
      Assets/Fungus/Scripts/VariableTypes/ColliderVariable.cs
  8. 2
      Assets/Fungus/Scripts/VariableTypes/GameObjectVariable.cs
  9. 2
      Assets/Fungus/Scripts/VariableTypes/MaterialVariable.cs
  10. 2
      Assets/Fungus/Scripts/VariableTypes/ObjectVariable.cs
  11. 2
      Assets/Fungus/Scripts/VariableTypes/Rigidbody2DVariable.cs
  12. 2
      Assets/Fungus/Scripts/VariableTypes/RigidbodyVariable.cs
  13. 2
      Assets/Fungus/Scripts/VariableTypes/SpriteVariable.cs
  14. 2
      Assets/Fungus/Scripts/VariableTypes/TextureVariable.cs
  15. 2
      Assets/Fungus/Scripts/VariableTypes/TransformVariable.cs

10
Assets/Fungus/Scripts/Components/Variable.cs

@ -234,7 +234,7 @@ namespace Fungus
if (Value != null) if (Value != null)
return Value.ToString(); return Value.ToString();
else else
return string.Empty; return "Null";
} }
protected virtual void Start() protected virtual void Start()
@ -246,7 +246,7 @@ namespace Fungus
//Apply to get from base system.object to T //Apply to get from base system.object to T
public override void Apply(SetOperator op, object value) public override void Apply(SetOperator op, object value)
{ {
if(value is T) if(value is T || value == null)
{ {
Apply(op, (T)value); Apply(op, (T)value);
} }
@ -277,7 +277,7 @@ namespace Fungus
//Apply to get from base system.object to T //Apply to get from base system.object to T
public override bool Evaluate(CompareOperator op, object value) public override bool Evaluate(CompareOperator op, object value)
{ {
if (value is T) if (value is T || value == null)
{ {
return Evaluate(op, (T)value); return Evaluate(op, (T)value);
} }
@ -301,10 +301,10 @@ namespace Fungus
switch (compareOperator) switch (compareOperator)
{ {
case CompareOperator.Equals: case CompareOperator.Equals:
condition = Value.Equals(value); condition = Equals(Value, value);// Value.Equals(value);
break; break;
case CompareOperator.NotEquals: case CompareOperator.NotEquals:
condition = !Value.Equals(value); condition = !Equals(Value, value);
break; break;
default: default:
Debug.LogError("The " + compareOperator.ToString() + " comparison operator is not valid."); Debug.LogError("The " + compareOperator.ToString() + " comparison operator is not valid.");

2
Assets/Fungus/Scripts/Utils/AllVariableTypes.cs

@ -285,7 +285,7 @@ namespace Fungus
{ {
return ta.DescFunc(this); return ta.DescFunc(this);
} }
return string.Empty; return "Null";
} }
public bool Compare(CompareOperator compareOperator, ref bool compareResult) public bool Compare(CompareOperator compareOperator, ref bool compareResult)

2
Assets/Fungus/Scripts/VariableTypes/AnimatorVariable.cs

@ -49,7 +49,7 @@ namespace Fungus
{ {
if (animatorRef == null) if (animatorRef == null)
{ {
return animatorVal != null ? animatorVal.ToString() : string.Empty; return animatorVal != null ? animatorVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/AudioSourceVariable.cs

@ -49,7 +49,7 @@ namespace Fungus
{ {
if (audioSourceRef == null) if (audioSourceRef == null)
{ {
return audioSourceVal != null ? audioSourceVal.ToString() : string.Empty; return audioSourceVal != null ? audioSourceVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/CollectionVariable.cs

@ -50,7 +50,7 @@ namespace Fungus
{ {
if (collectionRef == null) if (collectionRef == null)
{ {
return collectionVal != null ? collectionVal.ToString() : string.Empty; return collectionVal != null ? collectionVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/Collider2DVariable.cs

@ -50,7 +50,7 @@ namespace Fungus
{ {
if (collider2DRef == null) if (collider2DRef == null)
{ {
return collider2DVal != null ? collider2DVal.ToString() : string.Empty; return collider2DVal != null ? collider2DVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/ColliderVariable.cs

@ -50,7 +50,7 @@ namespace Fungus
{ {
if (colliderRef == null) if (colliderRef == null)
{ {
return colliderVal != null ? colliderVal.ToString() : string.Empty; return colliderVal != null ? colliderVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/GameObjectVariable.cs

@ -50,7 +50,7 @@ namespace Fungus
{ {
if (gameObjectRef == null) if (gameObjectRef == null)
{ {
return gameObjectVal != null ? gameObjectVal.ToString() : string.Empty; return gameObjectVal != null ? gameObjectVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/MaterialVariable.cs

@ -50,7 +50,7 @@ namespace Fungus
{ {
if (materialRef == null) if (materialRef == null)
{ {
return materialVal != null ? materialVal.ToString() : string.Empty; return materialVal != null ? materialVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/ObjectVariable.cs

@ -50,7 +50,7 @@ namespace Fungus
{ {
if (objectRef == null) if (objectRef == null)
{ {
return objectVal != null ? objectVal.ToString() : string.Empty; return objectVal != null ? objectVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/Rigidbody2DVariable.cs

@ -49,7 +49,7 @@ namespace Fungus
{ {
if (rigidbody2DRef == null) if (rigidbody2DRef == null)
{ {
return rigidbody2DVal != null ? rigidbody2DVal.ToString() : string.Empty; return rigidbody2DVal != null ? rigidbody2DVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/RigidbodyVariable.cs

@ -50,7 +50,7 @@ namespace Fungus
{ {
if (rigidbodyRef == null) if (rigidbodyRef == null)
{ {
return rigidbodyVal != null ? rigidbodyVal.ToString() : string.Empty; return rigidbodyVal != null ? rigidbodyVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/SpriteVariable.cs

@ -50,7 +50,7 @@ namespace Fungus
{ {
if (spriteRef == null) if (spriteRef == null)
{ {
return spriteVal != null ? spriteVal.ToString() : string.Empty; return spriteVal != null ? spriteVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/TextureVariable.cs

@ -50,7 +50,7 @@ namespace Fungus
{ {
if (textureRef == null) if (textureRef == null)
{ {
return textureVal != null ? textureVal.ToString() : string.Empty; return textureVal != null ? textureVal.ToString() : "Null";
} }
else else
{ {

2
Assets/Fungus/Scripts/VariableTypes/TransformVariable.cs

@ -50,7 +50,7 @@ namespace Fungus
{ {
if (transformRef == null) if (transformRef == null)
{ {
return transformVal != null ? transformVal.ToString() : string.Empty; return transformVal != null ? transformVal.ToString() : "Null";
} }
else else
{ {

Loading…
Cancel
Save