This commit is contained in:
clement 2024-01-11 17:16:12 +01:00
parent e12fed0489
commit 74a69cf8f7

View File

@ -39,16 +39,17 @@ public class MoleculeFactory : MonoBehaviour{
public GameObject createMolecule (string formula){ public GameObject createMolecule (string formula){
if(!moleculesDictionary.ContainsKey(formula)){ if(!moleculesDictionary.ContainsKey(formula)){
Debug.LogError("molecules does not existe in json") Debug.LogError("molecules does not existe in json");
} }
Molecule molecule = moleculesDictionary[formula]; Molecule molecule = moleculesDictionary[formula];
GameObject sortie = new GameObject(molecule.name); GameObject sortie = new GameObject(molecule.name);
foreach (Atom atom in molecule.atoms) { foreach (Atom atom in molecule.atoms) {
GameObject Sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.transform.parent = sortie.transform; sphere.transform.parent = sortie.transform;
sphere.name = atom.element; sphere.name = atom.element;
sphere.transform.localPosition = new Vector3(atom.geometry[0], atom.geometry[1], atom.geometry[2]); sphere.transform.localPosition = new Vector3(atom.geometry[0], atom.geometry[1], atom.geometry[2]);
//TODO: géré les laision
//TODO: géré la taille de l'atome //TODO: géré la taille de l'atome
//TODO: géré la couleur de l'atome //TODO: géré la couleur de l'atome
} }