feat:Molecule-json #8

Merged
Clement merged 10 commits from feat/Molecule-json into develop 2024-01-12 10:38:06 +00:00
Showing only changes of commit 74a69cf8f7 - Show all commits

View File

@ -39,16 +39,17 @@ public class MoleculeFactory : MonoBehaviour{
public GameObject createMolecule (string 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];
GameObject sortie = new GameObject(molecule.name);
foreach (Atom atom in molecule.atoms) {
GameObject Sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
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é les laision
//TODO: géré la taille de l'atome
//TODO: géré la couleur de l'atome
}