Exemplo n.º 1
0
            /// <summary>
            ///
            /// </summary>
            public void ProcessCondition()
            {
                ConditionNode conditionNode = m_currentNode as ConditionNode;
                Blackboard    blackboardA   = conditionNode.GetBlackboardA();
                string        keyA          = conditionNode.GetKeyA();
                bool          output        = true;

                if (conditionNode.GetSourceSelection() == 0)
                {
                    // blackboard v value
                    switch (conditionNode.GetValueType())
                    {
                    case ValueType.Boolean:
                        VariableManager.BoolComparison boolComparison = VariableManager.BoolComparison.EqualTo;
                        output = m_variableManager.EvaluateBlackboardVsValue(blackboardA, keyA, conditionNode.GetBooleanValue(), boolComparison);
                        break;

                    case ValueType.Float:
                        VariableManager.FloatComparison floatComparison = (VariableManager.FloatComparison)conditionNode.GetFloatSelection();
                        output = m_variableManager.EvaluateBlackboardVsValue(blackboardA, keyA, conditionNode.GetFloatValue(), floatComparison);
                        break;

                    case ValueType.String:
                        VariableManager.StringComparison stringComparison = VariableManager.StringComparison.EqualTo;
                        output = m_variableManager.EvaluateBlackboardVsValue(blackboardA, keyA, conditionNode.GetStringValue(), stringComparison);
                        break;
                    }
                }
                else
                {
                    // blackboard v blackboard
                    Blackboard blackboardB = conditionNode.GetBlackboardB();
                    string     keyB        = conditionNode.GetKeyB();

                    switch (conditionNode.GetValueType())
                    {
                    case ValueType.Boolean:
                        VariableManager.BoolComparison boolComparison = VariableManager.BoolComparison.EqualTo;
                        output = m_variableManager.EvaluateBlackboardVsBlackboard(blackboardA, keyA, blackboardB, keyB, boolComparison);
                        break;

                    case ValueType.Float:
                        VariableManager.FloatComparison floatComparison = (VariableManager.FloatComparison)conditionNode.GetFloatSelection();
                        output = m_variableManager.EvaluateBlackboardVsBlackboard(blackboardA, keyA, blackboardB, keyB, floatComparison);
                        break;

                    case ValueType.String:
                        VariableManager.StringComparison stringComparison = VariableManager.StringComparison.EqualTo;
                        output = m_variableManager.EvaluateBlackboardVsBlackboard(blackboardA, keyA, blackboardB, keyB, stringComparison);
                        break;
                    }
                }

                m_sceneManager.NextNode(output ? 0 : 1);
            }