public IMLFieldInfoContainer(FieldInfo fieldInfo, Node newNode, IMLSpecifications.DataTypes dataType, MonoBehaviour gameComponent) { this.fieldInfo = fieldInfo; this.nodeForField = newNode; this.gameComponentWhereFieldIs = gameComponent; this.DataType = dataType; }
/// <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; } }
public IMLFloat() { if (m_Values == null) { m_Values = new float[1]; } m_DataType = IMLSpecifications.DataTypes.Float; }
public IMLSerialVector(float[] newData) { m_DataType = IMLSpecifications.DataTypes.SerialVector; if (newData != null && newData.Length > 0) { SetValues(newData); } }
public IMLSerialVector(IMLBaseDataType newData) { m_DataType = IMLSpecifications.DataTypes.SerialVector; if (newData.Values != null && newData.Values.Length > 0) { SetValues(newData.Values); } }
public IMLSerialVector() { if (m_Values == null) { m_Values = new float[0]; } m_DataType = IMLSpecifications.DataTypes.SerialVector; }
public IMLVector3() { if (m_Values == null) { m_Values = new float[3]; } m_DataType = IMLSpecifications.DataTypes.Vector3; }
public IMLInteger() { if (m_Values == null) { m_Values = new float[1]; } m_DataType = IMLSpecifications.DataTypes.Integer; }
public IMLFloat(IMLBaseDataType newData) { if (m_Values == null) { m_Values = new float[1]; } m_DataType = IMLSpecifications.DataTypes.Float; if (newData.Values != null && newData.Values.Length > 0) { SetValue(newData.Values[0]); } }
public IMLVector3(IMLBaseDataType newData) { if (m_Values == null) { m_Values = new float[3]; } m_DataType = IMLSpecifications.DataTypes.Vector3; if (newData.Values != null && newData.Values.Length > 0) { SetValues(newData.Values); } }
public IMLSerialVector(int serialVectorSize) { m_DataType = IMLSpecifications.DataTypes.SerialVector; m_Values = new float[serialVectorSize]; }
/// <summary> /// Disconnect two IML Data Types if they are not equal /// </summary> /// <typeparam name="T"></typeparam> /// <param name="node"></param> /// <param name="from"></param> /// <param name="to"></param> /// <param name="expectedType"></param> /// <returns></returns> public static bool DisconnectIfNotSameIMLDataType <T>(this BaseDataTypeNode <T> node, NodePort from, NodePort to, IMLSpecifications.DataTypes expectedType) { // Make sure that the IMLDataType connected is matching our type bool disconnect = false; // If it is a IMLDataType, check that it is the exact same one if (from.node.GetType().Equals(typeof(IMLBaseDataType))) { var featureConnected = from.node as IFeatureIML; // If it is a feature... if (featureConnected != null) { // Check that dataType is the same as the expected one if (featureConnected.FeatureValues.DataType != expectedType) { from.Disconnect(to); disconnect = true; } } } return(disconnect); }
/// <summary> /// Disconnect a Feature Extractor from a Data Type Node if the feature extracted doesn't match our expected type /// </summary> /// <typeparam name="T"></typeparam> /// <param name="node"></param> /// <param name="from"></param> /// <param name="to"></param> /// <param name="expectedType"></param> /// <returns></returns> public static bool DisconnectFeatureNotSameIMLDataType <T>(this BaseDataTypeNode <T> node, NodePort from, NodePort to, IMLSpecifications.DataTypes expectedType) { // Make sure that the feature connected is matching our type bool disconnect = false; // If it is a feature... if (from.node is IFeatureIML featureConnected) { // If it is a feature... if (featureConnected != null) { // Check that dataType is the same as the expected one if (featureConnected.FeatureValues.DataType != expectedType) { from.Disconnect(to); disconnect = true; } } } return(disconnect); }