|
|
@ -87,82 +87,84 @@ namespace Fungus |
|
|
|
|
|
|
|
|
|
|
|
bool condition = false; |
|
|
|
bool condition = false; |
|
|
|
|
|
|
|
|
|
|
|
if (variable.GetType() == typeof(BooleanVariable)) |
|
|
|
var t = variable.GetType(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (t == typeof(BooleanVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BooleanVariable booleanVariable = (variable as BooleanVariable); |
|
|
|
BooleanVariable booleanVariable = (variable as BooleanVariable); |
|
|
|
condition = booleanVariable.Evaluate(compareOperator, booleanData.Value); |
|
|
|
condition = booleanVariable.Evaluate(compareOperator, booleanData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(IntegerVariable)) |
|
|
|
else if (t == typeof(IntegerVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
IntegerVariable integerVariable = (variable as IntegerVariable); |
|
|
|
IntegerVariable integerVariable = (variable as IntegerVariable); |
|
|
|
condition = integerVariable.Evaluate(compareOperator, integerData.Value); |
|
|
|
condition = integerVariable.Evaluate(compareOperator, integerData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(FloatVariable)) |
|
|
|
else if (t == typeof(FloatVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FloatVariable floatVariable = (variable as FloatVariable); |
|
|
|
FloatVariable floatVariable = (variable as FloatVariable); |
|
|
|
condition = floatVariable.Evaluate(compareOperator, floatData.Value); |
|
|
|
condition = floatVariable.Evaluate(compareOperator, floatData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(StringVariable)) |
|
|
|
else if (t == typeof(StringVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
StringVariable stringVariable = (variable as StringVariable); |
|
|
|
StringVariable stringVariable = (variable as StringVariable); |
|
|
|
condition = stringVariable.Evaluate(compareOperator, stringData.Value); |
|
|
|
condition = stringVariable.Evaluate(compareOperator, stringData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(AnimatorVariable)) |
|
|
|
else if (t == typeof(AnimatorVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AnimatorVariable animatorVariable = (variable as AnimatorVariable); |
|
|
|
AnimatorVariable animatorVariable = (variable as AnimatorVariable); |
|
|
|
condition = animatorVariable.Evaluate(compareOperator, animatorData.Value); |
|
|
|
condition = animatorVariable.Evaluate(compareOperator, animatorData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(AudioSourceVariable)) |
|
|
|
else if (t == typeof(AudioSourceVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AudioSourceVariable audioSourceVariable = (variable as AudioSourceVariable); |
|
|
|
AudioSourceVariable audioSourceVariable = (variable as AudioSourceVariable); |
|
|
|
condition = audioSourceVariable.Evaluate(compareOperator, audioSourceData.Value); |
|
|
|
condition = audioSourceVariable.Evaluate(compareOperator, audioSourceData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(ColorVariable)) |
|
|
|
else if (t == typeof(ColorVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ColorVariable colorVariable = (variable as ColorVariable); |
|
|
|
ColorVariable colorVariable = (variable as ColorVariable); |
|
|
|
condition = colorVariable.Evaluate(compareOperator, colorData.Value); |
|
|
|
condition = colorVariable.Evaluate(compareOperator, colorData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(GameObjectVariable)) |
|
|
|
else if (t == typeof(GameObjectVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
GameObjectVariable gameObjectVariable = (variable as GameObjectVariable); |
|
|
|
GameObjectVariable gameObjectVariable = (variable as GameObjectVariable); |
|
|
|
condition = gameObjectVariable.Evaluate(compareOperator, gameObjectData.Value); |
|
|
|
condition = gameObjectVariable.Evaluate(compareOperator, gameObjectData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(MaterialVariable)) |
|
|
|
else if (t == typeof(MaterialVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
MaterialVariable materialVariable = (variable as MaterialVariable); |
|
|
|
MaterialVariable materialVariable = (variable as MaterialVariable); |
|
|
|
condition = materialVariable.Evaluate(compareOperator, materialData.Value); |
|
|
|
condition = materialVariable.Evaluate(compareOperator, materialData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(ObjectVariable)) |
|
|
|
else if (t == typeof(ObjectVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ObjectVariable objectVariable = (variable as ObjectVariable); |
|
|
|
ObjectVariable objectVariable = (variable as ObjectVariable); |
|
|
|
condition = objectVariable.Evaluate(compareOperator, objectData.Value); |
|
|
|
condition = objectVariable.Evaluate(compareOperator, objectData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(Rigidbody2DVariable)) |
|
|
|
else if (t == typeof(Rigidbody2DVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Rigidbody2DVariable rigidbody2DVariable = (variable as Rigidbody2DVariable); |
|
|
|
Rigidbody2DVariable rigidbody2DVariable = (variable as Rigidbody2DVariable); |
|
|
|
condition = rigidbody2DVariable.Evaluate(compareOperator, rigidbody2DData.Value); |
|
|
|
condition = rigidbody2DVariable.Evaluate(compareOperator, rigidbody2DData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(SpriteVariable)) |
|
|
|
else if (t == typeof(SpriteVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SpriteVariable spriteVariable = (variable as SpriteVariable); |
|
|
|
SpriteVariable spriteVariable = (variable as SpriteVariable); |
|
|
|
condition = spriteVariable.Evaluate(compareOperator, spriteData.Value); |
|
|
|
condition = spriteVariable.Evaluate(compareOperator, spriteData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(TextureVariable)) |
|
|
|
else if (t == typeof(TextureVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
TextureVariable textureVariable = (variable as TextureVariable); |
|
|
|
TextureVariable textureVariable = (variable as TextureVariable); |
|
|
|
condition = textureVariable.Evaluate(compareOperator, textureData.Value); |
|
|
|
condition = textureVariable.Evaluate(compareOperator, textureData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(TransformVariable)) |
|
|
|
else if (t == typeof(TransformVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
TransformVariable transformVariable = (variable as TransformVariable); |
|
|
|
TransformVariable transformVariable = (variable as TransformVariable); |
|
|
|
condition = transformVariable.Evaluate(compareOperator, transformData.Value); |
|
|
|
condition = transformVariable.Evaluate(compareOperator, transformData.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(Vector2Variable)) |
|
|
|
else if (t == typeof(Vector2Variable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Vector2Variable vector2Variable = (variable as Vector2Variable); |
|
|
|
Vector2Variable vector2Variable = (variable as Vector2Variable); |
|
|
|
condition = vector2Variable.Evaluate(compareOperator, vector2Data.Value); |
|
|
|
condition = vector2Variable.Evaluate(compareOperator, vector2Data.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(Vector3Variable)) |
|
|
|
else if (t == typeof(Vector3Variable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Vector3Variable vector3Variable = (variable as Vector3Variable); |
|
|
|
Vector3Variable vector3Variable = (variable as Vector3Variable); |
|
|
|
condition = vector3Variable.Evaluate(compareOperator, vector3Data.Value); |
|
|
|
condition = vector3Variable.Evaluate(compareOperator, vector3Data.Value); |
|
|
@ -209,70 +211,72 @@ namespace Fungus |
|
|
|
return "Error: No variable selected"; |
|
|
|
return "Error: No variable selected"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var t = variable.GetType(); |
|
|
|
|
|
|
|
|
|
|
|
string summary = variable.Key + " "; |
|
|
|
string summary = variable.Key + " "; |
|
|
|
summary += Condition.GetOperatorDescription(compareOperator) + " "; |
|
|
|
summary += Condition.GetOperatorDescription(compareOperator) + " "; |
|
|
|
|
|
|
|
|
|
|
|
if (variable.GetType() == typeof(BooleanVariable)) |
|
|
|
if (t == typeof(BooleanVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += booleanData.GetDescription(); |
|
|
|
summary += booleanData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(IntegerVariable)) |
|
|
|
else if (t == typeof(IntegerVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += integerData.GetDescription(); |
|
|
|
summary += integerData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(FloatVariable)) |
|
|
|
else if (t == typeof(FloatVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += floatData.GetDescription(); |
|
|
|
summary += floatData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(StringVariable)) |
|
|
|
else if (t == typeof(StringVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += stringData.GetDescription(); |
|
|
|
summary += stringData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(AnimatorVariable)) |
|
|
|
else if (t == typeof(AnimatorVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += animatorData.GetDescription(); |
|
|
|
summary += animatorData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(AudioSourceVariable)) |
|
|
|
else if (t == typeof(AudioSourceVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += audioSourceData.GetDescription(); |
|
|
|
summary += audioSourceData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(ColorVariable)) |
|
|
|
else if (t == typeof(ColorVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += colorData.GetDescription(); |
|
|
|
summary += colorData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(GameObjectVariable)) |
|
|
|
else if (t == typeof(GameObjectVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += gameObjectData.GetDescription(); |
|
|
|
summary += gameObjectData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(MaterialVariable)) |
|
|
|
else if (t == typeof(MaterialVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += materialData.GetDescription(); |
|
|
|
summary += materialData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(ObjectVariable)) |
|
|
|
else if (t == typeof(ObjectVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += objectData.GetDescription(); |
|
|
|
summary += objectData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(Rigidbody2DVariable)) |
|
|
|
else if (t == typeof(Rigidbody2DVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += rigidbody2DData.GetDescription(); |
|
|
|
summary += rigidbody2DData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(SpriteVariable)) |
|
|
|
else if (t == typeof(SpriteVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += spriteData.GetDescription(); |
|
|
|
summary += spriteData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(TextureVariable)) |
|
|
|
else if (t == typeof(TextureVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += textureData.GetDescription(); |
|
|
|
summary += textureData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(TransformVariable)) |
|
|
|
else if (t == typeof(TransformVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += transformData.GetDescription(); |
|
|
|
summary += transformData.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(Vector2Variable)) |
|
|
|
else if (t == typeof(Vector2Variable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += vector2Data.GetDescription(); |
|
|
|
summary += vector2Data.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(Vector3Variable)) |
|
|
|
else if (t == typeof(Vector3Variable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
summary += vector3Data.GetDescription(); |
|
|
|
summary += vector3Data.GetDescription(); |
|
|
|
} |
|
|
|
} |
|
|
@ -282,7 +286,77 @@ namespace Fungus |
|
|
|
|
|
|
|
|
|
|
|
public override bool HasReference(Variable variable) |
|
|
|
public override bool HasReference(Variable variable) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return (variable == this.variable); |
|
|
|
bool retval = (variable == this.variable) || base.HasReference(variable); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var t = variable.GetType(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//this is a nightmare |
|
|
|
|
|
|
|
if (t == typeof(BooleanVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= booleanData.booleanRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(IntegerVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= integerData.integerRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(FloatVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= floatData.floatRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(StringVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= stringData.stringRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(AnimatorVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= animatorData.animatorRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(AudioSourceVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= audioSourceData.audioSourceRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(ColorVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= colorData.colorRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(GameObjectVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= gameObjectData.gameObjectRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(MaterialVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= materialData.materialRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(ObjectVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= objectData.objectRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(Rigidbody2DVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= rigidbody2DData.rigidbody2DRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(SpriteVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= spriteData.spriteRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(TextureVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= textureData.textureRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(TransformVariable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= transformData.transformRef == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(Vector2Variable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= vector2Data.vector2Ref == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (t == typeof(Vector3Variable)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
retval |= vector3Data.vector3Ref == variable; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return retval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override Color GetButtonColor() |
|
|
|
public override Color GetButtonColor() |
|
|
|