public MoleculePattern(MoleculeDef theMoleculeDef, ComponentPattern[] components) { _moleculeDef = theMoleculeDef; moleculeDef.Init(); _components = components; InitComponentPatterns(); }
public Molecule(MoleculePattern moleculePattern, RelativeTransform _localTransform, Complex _complex) { localTransform = new RelativeTransform(_localTransform); complex = _complex; definition = moleculePattern.moleculeDef; collisionRadius = interactionRadius = definition.radius; interactionRadius += 1f; CreateComponents(moleculePattern); SetColorForCurrentState(); }
public static void CreateMolecule() { MoleculeDef asset = ScriptableObject.CreateInstance <MoleculeDef>(); AssetDatabase.CreateAsset(asset, "Assets/Data/Molecules/newMolecule.asset"); AssetDatabase.SaveAssets(); Selection.activeObject = asset; EditorUtility.FocusProjectWindow(); }
public override bool Equals(object obj) { MoleculeDef other = obj as MoleculeDef; if (other != null && other.moleculeName != null) { return(other.moleculeName == moleculeName); } return(false); }
public MoleculePattern(Molecule molecule) { _moleculeDef = molecule.definition; if (molecule.definition.componentDefs == null) { //since this will mostly be used at runtime, the moleculeDef is probably already initialized //and this step will go away anyway once BNGL files are parsed to unity objects correctly moleculeDef.Init(); } _componentPatterns = new Dictionary <string, List <ComponentPattern> >(); foreach (string componentName in molecule.components.Keys) { if (!componentPatterns.ContainsKey(componentName)) { componentPatterns.Add(componentName, new List <ComponentPattern>()); } foreach (MoleculeComponent component in molecule.components[componentName]) { componentPatterns[componentName].Add(new ComponentPattern(component)); } } }