public void UpdateFlowchart(Fungus.Flowchart flowchart, Employee emp) { Fungus.StringVariable option = (Fungus.StringVariable)flowchart.GetVariable("option"); Fungus.BooleanVariable done = (Fungus.BooleanVariable)flowchart.GetVariable("done"); Fungus.BooleanVariable lunch = (Fungus.BooleanVariable)flowchart.GetVariable("lunch"); if (curr_state == State.LUNCH) { lunch.Value = true; } bool can_interact = (emp.GetMinDaysBetweenInteraction() >= emp.days_since_interaction); if (option.Evaluate(Fungus.CompareOperator.NotEquals, "default") && can_interact) { bool not_done = true; if (option.Evaluate(Fungus.CompareOperator.Equals, "bad")) { not_done = emp.SetCurrQuestion("bad"); } else if (option.Evaluate(Fungus.CompareOperator.Equals, "good")) { not_done = emp.SetCurrQuestion("good"); } if (not_done) { employee_manager.SetFlowchart(emp.curr_question, flowchart.FindBlock("Question").CommandList); } option.Value = "default"; done.Value = !not_done; emp.days_since_interaction = 0; } }
protected virtual bool EvaluateCondition() { BooleanVariable booleanVariable = variable as BooleanVariable; IntegerVariable integerVariable = variable as IntegerVariable; FloatVariable floatVariable = variable as FloatVariable; StringVariable stringVariable = variable as StringVariable; bool condition = false; if (booleanVariable != null) { condition = booleanVariable.Evaluate(compareOperator, booleanData.Value); } else if (integerVariable != null) { condition = integerVariable.Evaluate(compareOperator, integerData.Value); } else if (floatVariable != null) { condition = floatVariable.Evaluate(compareOperator, floatData.Value); } else if (stringVariable != null) { condition = stringVariable.Evaluate(compareOperator, stringData.Value); } return(condition); }
protected override bool EvaluateCondition() { if (variable == null) { return(false); } bool condition = false; if (variable.GetType() == typeof(BooleanVariable)) { BooleanVariable booleanVariable = (variable as BooleanVariable); condition = booleanVariable.Evaluate(compareOperator, booleanData.Value); } else if (variable.GetType() == typeof(IntegerVariable)) { IntegerVariable integerVariable = (variable as IntegerVariable); condition = integerVariable.Evaluate(compareOperator, integerData.Value); } else if (variable.GetType() == typeof(FloatVariable)) { FloatVariable floatVariable = (variable as FloatVariable); condition = floatVariable.Evaluate(compareOperator, floatData.Value); } else if (variable.GetType() == typeof(StringVariable)) { StringVariable stringVariable = (variable as StringVariable); condition = stringVariable.Evaluate(compareOperator, stringData.Value); } else if (variable.GetType() == typeof(GameObjectVariable)) { GameObjectVariable gameObjectVariable = (variable as GameObjectVariable); condition = gameObjectVariable.Evaluate(compareOperator, gameObjectData.Value); } return(condition); }
protected override bool EvaluateCondition() { if (variable == null) { return(false); } bool condition = false; if (variable.GetType() == typeof(BooleanVariable)) { BooleanVariable booleanVariable = (variable as BooleanVariable); condition = booleanVariable.Evaluate(compareOperator, booleanData.Value); } else if (variable.GetType() == typeof(IntegerVariable)) { IntegerVariable integerVariable = (variable as IntegerVariable); condition = integerVariable.Evaluate(compareOperator, integerData.Value); } else if (variable.GetType() == typeof(FloatVariable)) { FloatVariable floatVariable = (variable as FloatVariable); condition = floatVariable.Evaluate(compareOperator, floatData.Value); } else if (variable.GetType() == typeof(StringVariable)) { StringVariable stringVariable = (variable as StringVariable); condition = stringVariable.Evaluate(compareOperator, stringData.Value); } else if (variable.GetType() == typeof(AnimatorVariable)) { AnimatorVariable animatorVariable = (variable as AnimatorVariable); condition = animatorVariable.Evaluate(compareOperator, animatorData.Value); } else if (variable.GetType() == typeof(AudioSourceVariable)) { AudioSourceVariable audioSourceVariable = (variable as AudioSourceVariable); condition = audioSourceVariable.Evaluate(compareOperator, audioSourceData.Value); } else if (variable.GetType() == typeof(ColorVariable)) { ColorVariable colorVariable = (variable as ColorVariable); condition = colorVariable.Evaluate(compareOperator, colorData.Value); } else if (variable.GetType() == typeof(GameObjectVariable)) { GameObjectVariable gameObjectVariable = (variable as GameObjectVariable); condition = gameObjectVariable.Evaluate(compareOperator, gameObjectData.Value); } else if (variable.GetType() == typeof(MaterialVariable)) { MaterialVariable materialVariable = (variable as MaterialVariable); condition = materialVariable.Evaluate(compareOperator, materialData.Value); } else if (variable.GetType() == typeof(ObjectVariable)) { ObjectVariable objectVariable = (variable as ObjectVariable); condition = objectVariable.Evaluate(compareOperator, objectData.Value); } else if (variable.GetType() == typeof(Rigidbody2DVariable)) { Rigidbody2DVariable rigidbody2DVariable = (variable as Rigidbody2DVariable); condition = rigidbody2DVariable.Evaluate(compareOperator, rigidbody2DData.Value); } else if (variable.GetType() == typeof(SpriteVariable)) { SpriteVariable spriteVariable = (variable as SpriteVariable); condition = spriteVariable.Evaluate(compareOperator, spriteData.Value); } else if (variable.GetType() == typeof(TextureVariable)) { TextureVariable textureVariable = (variable as TextureVariable); condition = textureVariable.Evaluate(compareOperator, textureData.Value); } else if (variable.GetType() == typeof(TransformVariable)) { TransformVariable transformVariable = (variable as TransformVariable); condition = transformVariable.Evaluate(compareOperator, transformData.Value); } else if (variable.GetType() == typeof(Vector2Variable)) { Vector2Variable vector2Variable = (variable as Vector2Variable); condition = vector2Variable.Evaluate(compareOperator, vector2Data.Value); } else if (variable.GetType() == typeof(Vector3Variable)) { Vector3Variable vector3Variable = (variable as Vector3Variable); condition = vector3Variable.Evaluate(compareOperator, vector3Data.Value); } return(condition); }