示例#1
0
        private void AddElement(ValueType valueType)
        {
            string keyToAdd;

            switch (valueType)
            {
            default:
                keyToAdd = "Boolean " + m_blackboard.NewBooleanID();
                break;

            case ValueType.Float:
                keyToAdd = "Float " + m_blackboard.NewFloatID();
                break;

            case ValueType.String:
                keyToAdd = "String " + m_blackboard.NewStringID();
                break;
            }

            m_blackboard.AddKey(keyToAdd, valueType);
        }
            /// <summary>
            /// add callback function which adds a new element to a blackboard
            /// </summary>
            /// <param name="valueType">the value type of the element to add, e.g. Boolean, Float, etc.</param>
            private void AddElement(ValueType valueType)
            {
                string keyToAdd;

                // depending on the valueType, add a new Boolean, Float or String, with a unique ID to prevent duplicate keys
                switch (valueType)
                {
                default:
                    keyToAdd = "Boolean " + m_blackboard.NewBooleanID();
                    break;

                case ValueType.Float:
                    keyToAdd = "Float " + m_blackboard.NewFloatID();
                    break;

                case ValueType.String:
                    keyToAdd = "String " + m_blackboard.NewStringID();
                    break;
                }

                m_blackboard.AddKey(keyToAdd, valueType); // perform add
            }