25 Commits

Author SHA1 Message Date
27ce4e14a8 Merge remote-tracking branch 'origin/develop' into feature/AtomesFactory 2024-02-02 14:02:05 +01:00
9b7b156d7b add 3D atome 2024-02-02 14:33:35 +01:00
f7a2cc4c88 Add factory for animated Atome 2024-01-26 12:03:56 +01:00
cb0396e23c Merge pull request 'feat: liaison entre les molécules et couleur' (#9) from feat/molecule/bons into develop
Reviewed-on: #9
Reviewed-by: Mathis <mathis.ragot@epitech.eu>
2024-01-18 14:47:23 +01:00
aca2898e8c Merge remote-tracking branch 'origin/develop' into feat/molecule/bons
# Conflicts:
#	Assets/Editor/Vuforia/ImageTargetTextures/T-VIR/hydro_scaled.jpg.meta
#	Assets/Editor/Vuforia/ImageTargetTextures/T-VIR/hydrogen_scaled.jpg.meta
#	Assets/Editor/Vuforia/ImageTargetTextures/T-VIR/hydrogene_marker_scaled.jpg.meta
#	Assets/Editor/Vuforia/ImageTargetTextures/T-VIR/oxy_scaled.jpg.meta
#	Assets/Editor/Vuforia/ImageTargetTextures/T-VIR/oxygen_scaled.jpg.meta
#	Assets/Editor/Vuforia/ImageTargetTextures/T-VIR/oxygene_marker_scaled.jpg.meta
#	Assets/XR/Settings/OpenXR Package Settings.asset
#	Assets/__Scenes/MainMenu.unity
2024-01-18 13:46:44 +01:00
807aa8c3c6 Merge pull request 'add Atomes Factory' (#10) from feature/AtomesFactory into develop
Reviewed-on: #10
Reviewed-by: Clement <clement@jo85.com>
2024-01-18 12:02:57 +01:00
3777d06a0e Rename Classname 2024-01-18 12:00:00 +01:00
16bd5bfb6c Merge remote-tracking branch 'origin/develop' into feature/AtomesFactory 2024-01-18 11:46:03 +01:00
da9d57b0bb vue foria config 2024-01-18 11:44:22 +01:00
5346e596c8 [feature/AtomesFactory] - remove testing file 2024-01-18 11:28:02 +01:00
f613217658 [feature/AtomesFactory] - Add json for atomes 2024-01-18 10:38:59 +01:00
bc2b9e02fd add Atomes Factory 2024-01-12 15:37:09 +01:00
34f74aa443 Merge pull request 'feature/multi_targets' (#7) from feature/multi_targets into develop
Reviewed-on: #7
Reviewed-by: Clement <clement@jo85.com>
2024-01-12 11:50:43 +01:00
f181fd9935 fix du mauvais nom de scene dans le script ChangeScene.cs 2024-01-12 11:50:10 +01:00
1c76868eee Merge remote-tracking branch 'origin/develop' into feature/multi_targets
# Conflicts:
#	ProjectSettings/EditorBuildSettings.asset
#	QCAR/somedata16
2024-01-12 11:39:02 +01:00
f1ec062047 ajout du font fallback 2024-01-12 11:37:29 +01:00
9c23975b20 rajouts des fonts text mesh pro 2024-01-12 11:36:49 +01:00
aff9df22cf Merge remote-tracking branch 'origin/develop' into feature/multi_targets
# Conflicts:
#	Assets/Resources/VuforiaConfiguration.asset
#	Assets/__Scenes/CompositionMode.unity
#	Packages/com.ptc.vuforia.engine-10.18.4.tgz
#	Packages/manifest.json
#	Packages/packages-lock.json
#	ProjectSettings/EditorBuildSettings.asset
#	ProjectSettings/ProjectSettings.asset
#	ProjectSettings/TagManager.asset
2024-01-12 11:03:32 +01:00
a7912733e5 Ajout dans le canvas d'éléments UI (nom, description....) 2024-01-12 10:54:51 +01:00
0313fe28a1 Suppression du build de la CI 2024-01-12 09:57:07 +01:00
5237a32bb4 ajout de la keystore de debug (user) + changement de la target version d'android
Some checks failed
Actions 😎 / Build my project ✨ (push) Failing after 1m2s
Actions 😎 / Release to the Google Play Store (push) Has been skipped
Actions 😎 / Build my project ✨ (pull_request) Failing after 53s
Actions 😎 / Release to the Google Play Store (pull_request) Has been skipped
2024-01-11 16:18:35 +01:00
afa265dd31 Affichage des molécules unitairement et en mode fusion
Some checks failed
Actions 😎 / Build my project ✨ (push) Failing after 1m21s
Actions 😎 / Release to the Google Play Store (push) Has been skipped
2024-01-11 11:26:53 +01:00
84136dcc5c MAJ du fichier d'action build.yaml
Some checks failed
Actions 😎 / Build my project ✨ (push) Failing after 5m40s
2023-12-22 15:05:47 +01:00
ce3c956544 MAJ du fichier d'action build.yaml
Some checks failed
Actions 😎 / Build my project ✨ (push) Has been cancelled
2023-12-22 15:02:10 +01:00
8f105732f7 Ajout de la multitarget pour générer un préfab
Some checks failed
Actions 😎 / Build my project ✨ (push) Failing after 3m57s
2023-12-22 14:36:52 +01:00
30 changed files with 262 additions and 50 deletions

8
Assets/script/Atome.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d277baeb8e7f7794fb44493815552a02
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,134 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class AtomeFactory : MonoBehaviour{
public TextAsset jsonFile;
private static AtomeFactory instance;
private AtomesInformation atomeInJson;
private Dictionary<string, AtomeInformation> AtomeDictionary;
public AtomeFactory(TextAsset jsonFile){
AtomeFactory.instance = this;
AtomeDictionary = new Dictionary<string, AtomeInformation>();
atomeInJson = JsonUtility.FromJson<AtomesInformation>(jsonFile.text);
foreach (var atome in atomeInJson.atomes){
AtomeDictionary.Add(atome.symbol, atome);
}
}
public static AtomeFactory getInstrance(){
if(AtomeFactory.instance == null){
Debug.LogError("no Json file");
}
return AtomeFactory.instance;
}
public static AtomeFactory getInstrance(TextAsset jsonFile){
if(AtomeFactory.instance == null){
AtomeFactory.instance = new AtomeFactory(jsonFile);
}
return AtomeFactory.instance;
}
public AtomeInformation createAtome(string symbol){
if(!AtomeDictionary.ContainsKey(symbol)){
Debug.LogError("Atome does not existe in json");
return null;
}
AtomeInformation atome = AtomeDictionary[symbol];
return atome;
}
public GameObject createAnimatedAtome(string symbol) {
if(!AtomeDictionary.ContainsKey(symbol)){
Debug.LogError("Atome does not existe in json");
return null;
}
AtomeInformation atomeinfo = AtomeDictionary[symbol];
GameObject Parent = new GameObject(atomeinfo.name);
int ElectronsNumber = atomeinfo.protons;
//Symbol
GameObject atome = CreateSymbolAnimation(atomeinfo);
atome.transform.parent = Parent.transform;
//Electrons
for (int i = 1; ElectronsNumber > 0; i++) {
int nbrElectronLayer = 2 * (i * i);
GameObject electrons = CreateElectronsAnimation(Mathf.Min(ElectronsNumber, nbrElectronLayer), (float)i);
electrons.transform.parent = Parent.transform;
ElectronsNumber -= nbrElectronLayer;
}
//rajouter electron == protons
return Parent;
}
private GameObject DrawCircle(float orbitRadius)
{
GameObject orbitCircle = new GameObject("Orbit Circle");
LineRenderer lineRenderer = orbitCircle.AddComponent<LineRenderer>();
lineRenderer.useWorldSpace = false;
lineRenderer.widthMultiplier = 0.05f; // Ajustez l'épaisseur de la ligne si nécessaire.
lineRenderer.positionCount = 100 + 1;
//Add Color
Color myColor = new Color(0, 0, 1, 1);
ColorUtility.TryParseHtmlString("#7F7F7F", out myColor);
orbitCircle.GetComponent<Renderer>().material.color = myColor;
for (int i = 0; i <= 100; i++)
{
float angle = i * 2 * Mathf.PI / 100;
float x = Mathf.Cos(angle) * orbitRadius;
float y = Mathf.Sin(angle) * orbitRadius;
lineRenderer.SetPosition(i, new Vector3(x, 0f, y));
}
return orbitCircle;
}
private GameObject CreateSymbolAnimation(AtomeInformation info) {
//Create GameObject
GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
//Add information
sphere.name = info.symbol;
sphere.transform.position = new Vector3(0, 0, 0);
//Add Color
Color myColor = new Color(0, 0, 1, 1);
ColorUtility.TryParseHtmlString(info.representation.color, out myColor);
sphere.GetComponent<Renderer>().material.color = myColor;
return sphere;
}
private GameObject CreateElectronsAnimation(int electrons, float layer) {
GameObject ParentLayer = new GameObject("Electrons");
for (int i = 0; i < electrons; i++) {
float angle = i * Mathf.PI * 2 / electrons;
float x = Mathf.Cos(angle) * layer;
float z = Mathf.Sin(angle) * layer;
float y = 0f;
GameObject electron = GameObject.CreatePrimitive(PrimitiveType.Sphere);
electron.name = "Electron" + i;
electron.transform.position = new Vector3(x, y, z);
electron.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
electron.transform.parent = ParentLayer.transform;
}
GameObject orbit = DrawCircle(layer);
orbit.transform.parent = ParentLayer.transform;
return ParentLayer;
}
}

View File

@ -1,49 +0,0 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class AtomeFactory : MonoBehaviour{
public TextAsset jsonFile;
private static AtomeFactory instance;
private AtomesInformation atomeInJson;
private Dictionary<string, AtomeInformation> AtomeDictionary;
public AtomeFactory(TextAsset jsonFile){
AtomeFactory.instance = this;
AtomeDictionary = new Dictionary<string, AtomeInformation>();
atomeInJson = JsonUtility.FromJson<AtomesInformation>(jsonFile.text);
foreach (var atome in atomeInJson.atomes){
AtomeDictionary.Add(atome.symbol, atome);
}
}
public static AtomeFactory getInstrance(){
if(AtomeFactory.instance == null){
Debug.LogError("no Json file");
}
return AtomeFactory.instance;
}
public static AtomeFactory getInstrance(TextAsset jsonFile){
if(AtomeFactory.instance == null){
AtomeFactory.instance = new AtomeFactory(jsonFile);
}
return AtomeFactory.instance;
}
public AtomeInformation createAtome(string symbol){
if(!AtomeDictionary.ContainsKey(symbol)){
Debug.LogError("Atome does not existe in json");
}
AtomeInformation atome = AtomeDictionary[symbol];
return atome;
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: daab5552b7014024c9b81a31c7eb0b12
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,53 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Animation
serializedVersion: 7
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings: []
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3f4a98ccdd3a2514495ffff7ef525aa7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,12 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Animator Controller
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 825a7187bec92284dbce290965de4dba
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

19
Assets/script/Testor.cs Normal file
View File

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
class MoleculeFactoryTester: MonoBehaviour {
public TextAsset moleculeJson;
public TextAsset atomJson;
void Start(){
MoleculeFactory factory = MoleculeFactory.getInstrance(this.moleculeJson);
AtomeFactory atomeFactory = AtomeFactory.getInstrance(this.atomJson);
GameObject mol = atomeFactory.createAnimatedAtome("Na");
//mol.transform.position = new Vector3(0,1,0);
//GameObject bon = GameOject.CreatePrimitive(PrimitiveType.)
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d15c31ec91cb674fac22415c1ceff75
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1 +1 @@
AAABmYLL8/oCWYDVnt66QIDwPq6z4DN6r3/58aZWC0zcxYa43TCnvCp9IGuXZLgAObCqIm1fhMsWLttc6QAE6obPbuzCjEssQlT41wW38sIVuVhmsw6vfjVsXAQG/GQOgamARLtOkhTKi309FNa+3akhJu9wuEv5jF3vfRbPBoeMCWZuk4Pr8aP7mPH8+10geWHoSWbxgsaEEgrE0yO2xoQwTy2XOmCzZytqk+moWXU7VBu+0//q+koDSnWbjOkEGUfRwMmBJIK9J5TDJrSf/QZYBcEx1daR47cicuXzCb81VtaSvU5VIb9anoX6fukOHe/nCAfsltXFn+4G24NKlejZ568=
AAABmY7g9UmlfucNZM2mK1+zBTca7O7gdAXUc9FcH4yUbYfsFOfH72rVb0qPESQq/9HBlqfD04SyJF6jtD6oQDsZxFAYgmMCBkOzNr/C/s4mdV37Qw5Nm9GqecPYpccvAWOqH/VAtFBp5ksgnAnVhuHUqh0NmvpixXq82Meo/bg7usPAWSDsQt/6kR89nttLOknq/Rt+SN8E91Txj6nsYZH8gsxrgC9MYPO0koHuIvfeLk0wcqrMzxZawaNLp6CNWgUYDXWIWW1AtB9dY5p56nnk/Yd4MyRevYDtcWdXCdiam48zdO470AuA8DkAFHOttVURidwRkVKq4z40E6J+5V3NqDg=