コード例 #1
0
        /// <summary>
        /// Instantiates an abstract IML base data into a specific one
        /// </summary>
        /// <param name="dataToInstantiate"></param>
        /// <param name="dataToReadFrom"></param>
        /// <param name="IMLType"></param>
        public static void InstantiateIMLData(ref IMLBaseDataType dataToInstantiate, IMLSpecifications.DataTypes IMLType)
        {
            switch (IMLType)
            {
            case IMLSpecifications.DataTypes.Float:
                dataToInstantiate = new IMLFloat();
                break;

            case IMLSpecifications.DataTypes.Integer:
                dataToInstantiate = new IMLInteger();
                break;

            case IMLSpecifications.DataTypes.Vector2:
                dataToInstantiate = new IMLVector2();
                break;

            case IMLSpecifications.DataTypes.Vector3:
                dataToInstantiate = new IMLVector3();
                break;

            case IMLSpecifications.DataTypes.Vector4:
                dataToInstantiate = new IMLVector4();
                break;

            case IMLSpecifications.DataTypes.SerialVector:
                dataToInstantiate = new IMLSerialVector();
                break;

            default:
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Makes sure the list of outputs is properly configured
        /// </summary>
        private void UpdateOutputsList()
        {
            // Check if we actually need to rebuild the desired output features
            // If we have no record of the structure OR current and last known structures doesn't match
            if (m_LastKnownDesireOutputsConfig == null || !m_LastKnownDesireOutputsConfig.SequenceEqual(m_DesiredOutputsConfig))
            {
                //Debug.Log("[UPDATE] REBUILDING OUTPUT LIST");
                // Build Output List
                BuildOutputFeaturesFromOutputConfig();
                m_LastKnownDesireOutputsConfig = m_DesiredOutputsConfig;
            }

            // If the size of the output configuration doesn't match the output features size, something is wrong
            if (m_DesiredOutputsConfig.Count != m_DesiredOutputFeatures.Count)
            {
                // Re-Build Output List
                BuildOutputFeaturesFromOutputConfig();
            }
            // If both lists are the same size...
            else
            {
                // Double making sure that each of the outputs specified in the configuration matches the required type
                for (int i = 0; i < m_DesiredOutputFeatures.Count; i++)
                {
                    // If the data type doesn't match the one specified in the configuration...
                    if (m_DesiredOutputFeatures[i].DataType != (IMLSpecifications.DataTypes)m_DesiredOutputsConfig[i])
                    {
                        //Debug.LogError("DataType not equal!");
                        // Correct that output feature with the right type
                        switch (m_DesiredOutputsConfig[i])
                        {
                        case IMLSpecifications.OutputsEnum.Float:
                            m_DesiredOutputFeatures[i] = new IMLFloat();
                            break;

                        case IMLSpecifications.OutputsEnum.Integer:
                            m_DesiredOutputFeatures[i] = new IMLInteger();
                            break;

                        case IMLSpecifications.OutputsEnum.Vector2:
                            m_DesiredOutputFeatures[i] = new IMLVector2();
                            break;

                        case IMLSpecifications.OutputsEnum.Vector3:
                            m_DesiredOutputFeatures[i] = new IMLVector3();
                            break;

                        case IMLSpecifications.OutputsEnum.Vector4:
                            m_DesiredOutputFeatures[i] = new IMLVector4();
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Instantiates an abstract IML base data into a specific one
        /// </summary>
        /// <param name="dataToInstantiate"></param>
        /// <param name="dataToReadFrom"></param>
        /// <param name="IMLType"></param>
        public static void InstantiateIMLData(ref IMLBaseDataType dataToInstantiate, IMLBaseDataType dataToReadFrom)
        {
            if (dataToReadFrom == null)
            {
                Debug.LogError("Can't instantiate a null IML data type!");
                return;
            }

            switch (dataToReadFrom.DataType)
            {
            case IMLSpecifications.DataTypes.Float:
                dataToInstantiate = new IMLFloat(dataToReadFrom);
                break;

            case IMLSpecifications.DataTypes.Integer:
                dataToInstantiate = new IMLInteger(dataToReadFrom);
                break;

            case IMLSpecifications.DataTypes.Vector2:
                dataToInstantiate = new IMLVector2(dataToReadFrom);
                break;

            case IMLSpecifications.DataTypes.Vector3:
                dataToInstantiate = new IMLVector3(dataToReadFrom);
                break;

            case IMLSpecifications.DataTypes.Vector4:
                dataToInstantiate = new IMLVector4(dataToReadFrom);
                break;

            case IMLSpecifications.DataTypes.SerialVector:
                dataToInstantiate = new IMLSerialVector(dataToReadFrom);
                break;

            default:
                break;
            }
        }