From e12fed048949652afb389d2ce97acbcf2e2e7037 Mon Sep 17 00:00:00 2001 From: clement Date: Thu, 11 Jan 2024 17:11:59 +0100 Subject: [PATCH] normalent on est quasi bon --- Assets/script/MoleculeFactory.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Assets/script/MoleculeFactory.cs b/Assets/script/MoleculeFactory.cs index 8f56ee1..4a32dd4 100644 --- a/Assets/script/MoleculeFactory.cs +++ b/Assets/script/MoleculeFactory.cs @@ -42,11 +42,17 @@ public class MoleculeFactory : MonoBehaviour{ Debug.LogError("molecules does not existe in json") } Molecule molecule = moleculesDictionary[formula]; - - Debug.Log(molecule); - - //return GO - return null; + GameObject sortie = new GameObject(molecule.name); + + foreach (Atom atom in molecule.atoms) { + GameObject Sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); + sphere.transform.parent = sortie.transform; + sphere.name = atom.element; + sphere.transform.localPosition = new Vector3(atom.geometry[0], atom.geometry[1], atom.geometry[2]); + //TODO: géré la taille de l'atome + //TODO: géré la couleur de l'atome + } + return sortie; } } \ No newline at end of file