Compare commits
14 Commits
f4be67ca29
...
feature/qu
Author | SHA1 | Date | |
---|---|---|---|
427a77ab71 | |||
8a3b3d6c98 | |||
bddd04413e | |||
71f04dc4d5 | |||
7084fcaa30 | |||
48d607dfdf | |||
c779e6348b | |||
a642cc0a38 | |||
91e3d2e28a | |||
9c5f5b15fb | |||
27ce4e14a8 | |||
9b7b156d7b | |||
3217569320 | |||
f7a2cc4c88 |
@ -28,6 +28,7 @@ public class ActiveScoppedElements : MonoBehaviour
|
|||||||
public TextAsset atomJsonFile;
|
public TextAsset atomJsonFile;
|
||||||
public HashSet<String> actives = new HashSet<String>();
|
public HashSet<String> actives = new HashSet<String>();
|
||||||
public HashSet<GameObject> InstantiatesObject = new HashSet<GameObject>();
|
public HashSet<GameObject> InstantiatesObject = new HashSet<GameObject>();
|
||||||
|
public HashSet<GameObject> AtomInstantiatesObjects = new HashSet<GameObject>();
|
||||||
public TextMeshProUGUI textToUpdate;
|
public TextMeshProUGUI textToUpdate;
|
||||||
public TextMeshProUGUI objectInstantiateText;
|
public TextMeshProUGUI objectInstantiateText;
|
||||||
public HashSet<GameObject> DisableGameObjects = new HashSet<GameObject>();
|
public HashSet<GameObject> DisableGameObjects = new HashSet<GameObject>();
|
||||||
@ -62,7 +63,7 @@ public class ActiveScoppedElements : MonoBehaviour
|
|||||||
{
|
{
|
||||||
actives.Add(name);
|
actives.Add(name);
|
||||||
RefreshText();
|
RefreshText();
|
||||||
RefreshAtom(name);
|
RefreshAtom(name, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,10 +233,32 @@ public class ActiveScoppedElements : MonoBehaviour
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RenderAtom(String elementName)
|
private void RenderAtom(String elementName, bool toAdd)
|
||||||
{
|
{
|
||||||
|
var cleanedElement = CleanStringOfDigits(elementName);
|
||||||
|
if (!toAdd)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var a = AtomInstantiatesObjects.First(t => t.name == ("ATOM_" + cleanedElement));
|
||||||
|
if (a != null)
|
||||||
|
{
|
||||||
|
AtomInstantiatesObjects.Remove(a);
|
||||||
|
Destroy(a);
|
||||||
|
Debug.Log("AtomInstantiatesObjects.Remove(a) called !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.Log("pas trouvé");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
var atomObject = GameObject.Find(elementName);
|
var atomObject = GameObject.Find(elementName);
|
||||||
if (atomObject == null) {
|
if (atomObject == null) {
|
||||||
|
Debug.Log("atomObject=null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (atomObject.transform.childCount >= 1) {
|
if (atomObject.transform.childCount >= 1) {
|
||||||
@ -243,7 +266,7 @@ public class ActiveScoppedElements : MonoBehaviour
|
|||||||
Debug.Log("Object already created !");
|
Debug.Log("Object already created !");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var cleanedElement = CleanStringOfDigits(elementName);
|
|
||||||
var factory = MoleculeFactory.getInstrance(this.jsonFile);
|
var factory = MoleculeFactory.getInstrance(this.jsonFile);
|
||||||
factory.setAtomFactory(this._atomFactory);
|
factory.setAtomFactory(this._atomFactory);
|
||||||
if (!factory.GetAtomFactory().hasAtome(cleanedElement))
|
if (!factory.GetAtomFactory().hasAtome(cleanedElement))
|
||||||
@ -251,16 +274,24 @@ public class ActiveScoppedElements : MonoBehaviour
|
|||||||
Debug.Log("No atom found with this formula '" + cleanedElement + "'");
|
Debug.Log("No atom found with this formula '" + cleanedElement + "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var obj = this._atomFactory.createAnimatedAtome(cleanedElement);
|
||||||
|
obj.name = "ATOM_" + cleanedElement;
|
||||||
|
obj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
|
||||||
|
|
||||||
var obj = Instantiate(atomPrefabToInstantiate, new Vector3(0, 0, 0), Quaternion.identity);
|
Quaternion cameraRotation = Quaternion.Euler(0, Camera.main.transform.rotation.eulerAngles.y, 0);
|
||||||
AtomPrefab objPrefab = obj.GetComponent<AtomPrefab>();
|
obj.transform.localPosition = new Vector3(0, 0, 0);
|
||||||
AtomeInformation info = factory.GetAtomFactory().createAtome(cleanedElement);
|
obj.transform.SetParent(atomObject.transform, false);
|
||||||
objPrefab.Render(info);
|
obj.transform.rotation = cameraRotation;
|
||||||
|
AtomInstantiatesObjects.Add(obj);
|
||||||
|
|
||||||
|
//var obj = Instantiate(atomPrefabToInstantiate, new Vector3(0, 0, 0), Quaternion.identity);
|
||||||
|
//AtomPrefab objPrefab = obj.GetComponent<AtomPrefab>();
|
||||||
|
//AtomeInformation info = factory.GetAtomFactory().createAtome(cleanedElement);
|
||||||
|
//objPrefab.Render(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshAtom(String elementName)
|
private void RefreshAtom(String elementName, bool toAdd)
|
||||||
{
|
{
|
||||||
RenderAtom(elementName);
|
|
||||||
var objToFind = FindGameObjectWithFormula();
|
var objToFind = FindGameObjectWithFormula();
|
||||||
if (objToFind != null)
|
if (objToFind != null)
|
||||||
{
|
{
|
||||||
@ -269,6 +300,13 @@ public class ActiveScoppedElements : MonoBehaviour
|
|||||||
{
|
{
|
||||||
throw new Exception("NO MAIN CAMERA DEFINED ");
|
throw new Exception("NO MAIN CAMERA DEFINED ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var atomInstantiatesObject in AtomInstantiatesObjects)
|
||||||
|
{
|
||||||
|
Destroy(atomInstantiatesObject);
|
||||||
|
}
|
||||||
|
AtomInstantiatesObjects.Clear();
|
||||||
|
|
||||||
Vector3 cameraPosition = Camera.main.transform.position;
|
Vector3 cameraPosition = Camera.main.transform.position;
|
||||||
Quaternion cameraRotation = Quaternion.Euler(0, Camera.main.transform.rotation.eulerAngles.y, 0);
|
Quaternion cameraRotation = Quaternion.Euler(0, Camera.main.transform.rotation.eulerAngles.y, 0);
|
||||||
Vector3 position = cameraPosition + cameraRotation * Vector3.forward * 0.35f;
|
Vector3 position = cameraPosition + cameraRotation * Vector3.forward * 0.35f;
|
||||||
@ -299,6 +337,7 @@ public class ActiveScoppedElements : MonoBehaviour
|
|||||||
}
|
}
|
||||||
InstantiatesObject.Clear();
|
InstantiatesObject.Clear();
|
||||||
EnableAllMarkerModel();
|
EnableAllMarkerModel();
|
||||||
|
RenderAtom(elementName, toAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InstantiatesObject.Count > 0 && objectInstantiateText != null) {
|
if (InstantiatesObject.Count > 0 && objectInstantiateText != null) {
|
||||||
@ -380,6 +419,6 @@ public class ActiveScoppedElements : MonoBehaviour
|
|||||||
Debug.Log("Removed " + elementName);
|
Debug.Log("Removed " + elementName);
|
||||||
actives.Remove(elementName);
|
actives.Remove(elementName);
|
||||||
RefreshText();
|
RefreshText();
|
||||||
RefreshAtom(elementName);
|
RefreshAtom(elementName, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 28b9d8dbb107495ca4f8eee7c58c8331
|
guid: 37af6d74498845929dd6e83207cb290b
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: bef4d72022e54ca79ed956f8c53ba384
|
guid: e9c72328fc874d839109b14cf10682b3
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
BIN
Assets/Editor/Vuforia/ImageTargetTextures/T-VIR/Na_scaled.jpg
(Stored with Git LFS)
Normal file
BIN
Assets/Editor/Vuforia/ImageTargetTextures/T-VIR/Na_scaled.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,179 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a0ad14f92cb7404986a81b94582472d0
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 12
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
flipGreenChannel: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMipmapLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 0
|
||||||
|
wrapV: 0
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 1
|
||||||
|
swizzle: 50462976
|
||||||
|
cookieLightType: 2
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Server
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: iPhone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Lumin
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Windows Store Apps
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
mipmapLimitGroupName:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 1203a963a0b24da48a481e62246ee716
|
guid: 79885e89e6674ad491bbbf9042a3ff9f
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 39977f35879443cb8977b0765c069367
|
guid: 3c04e0e5c1c64aa9b6e290b3b324bc83
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 79979c2c9e3149a3aa74c3f3b1581859
|
guid: 008ede79072843598b9e0fe69288cc10
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 173366883292404a8fb0129994277f47
|
guid: fd028b6367dc453dbd4bde749074ca75
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
@ -24,7 +24,7 @@ MonoBehaviour:
|
|||||||
shareRecordingsInITunes: 0
|
shareRecordingsInITunes: 0
|
||||||
logLevel: 1
|
logLevel: 1
|
||||||
version: 10.18.4
|
version: 10.18.4
|
||||||
eulaAcceptedVersions: '{"Values":["10.17","10.18","0.0","10.15"]}'
|
eulaAcceptedVersions: '{"Values":["10.17","10.18","0.0","10.15","9.8","10.20","10.19"]}'
|
||||||
database:
|
database:
|
||||||
disableModelExtraction: 0
|
disableModelExtraction: 0
|
||||||
shaders:
|
shaders:
|
||||||
|
39
Assets/Scripts/Quizz/LoadingManager.cs
Normal file
39
Assets/Scripts/Quizz/LoadingManager.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class LoadingManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public GameObject LoadingScreen;
|
||||||
|
public GameObject TutorialScreen;
|
||||||
|
public GameObject GameScreen;
|
||||||
|
|
||||||
|
private bool launched = false;
|
||||||
|
private bool game = false;
|
||||||
|
|
||||||
|
void Start() {
|
||||||
|
LoadingScreen.GetComponent<Canvas>().enabled = true;
|
||||||
|
TutorialScreen.GetComponent<Canvas>().enabled = false;
|
||||||
|
GameScreen.GetComponent<Canvas>().enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LaunchTutorial() {
|
||||||
|
if (!launched) {
|
||||||
|
LoadingScreen.GetComponent<Canvas>().enabled = false;
|
||||||
|
TutorialScreen.GetComponent<Canvas>().enabled = true;
|
||||||
|
launched = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LaunchGame() {
|
||||||
|
if (!game) {
|
||||||
|
TutorialScreen.GetComponent<Canvas>().enabled = false;
|
||||||
|
GameScreen.GetComponent<Canvas>().enabled = true;
|
||||||
|
game = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LeaveApp() {
|
||||||
|
Application.Quit();
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Quizz/LoadingManager.cs.meta
Normal file
11
Assets/Scripts/Quizz/LoadingManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1ce983d8b15e46d4491e43d7c8ed2568
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
90
Assets/Scripts/Quizz/OLD.cs
Normal file
90
Assets/Scripts/Quizz/OLD.cs
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class aQuestion
|
||||||
|
{
|
||||||
|
public string aquestion;
|
||||||
|
public string[] answers;
|
||||||
|
public int good_answer;
|
||||||
|
public int type;
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class aQuestions
|
||||||
|
{
|
||||||
|
public aQuestion[] aquestions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class QsuizzManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public GameObject LoadingCanvas;
|
||||||
|
public GameObject TutorialCanvas;
|
||||||
|
public GameObject aQuestions;
|
||||||
|
public GameObject Home;
|
||||||
|
public TextAsset jsonFile;
|
||||||
|
private bool launched;
|
||||||
|
private bool started;
|
||||||
|
private int answer_button;
|
||||||
|
|
||||||
|
void Start() {
|
||||||
|
LoadingCanvas.GetComponent<Canvas>().enabled = true;
|
||||||
|
TutorialCanvas.GetComponent<Canvas>().enabled = false;
|
||||||
|
aQuestions.GetComponent<Canvas>().enabled = false;
|
||||||
|
Home.GetComponent<Canvas>().enabled = false;
|
||||||
|
launched = false;
|
||||||
|
started = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowTutorial() {
|
||||||
|
if (!launched) {
|
||||||
|
LoadingCanvas.GetComponent<Canvas>().enabled = false;
|
||||||
|
TutorialCanvas.GetComponent<Canvas>().enabled = true;
|
||||||
|
launched = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LaunchQuizz() {
|
||||||
|
if (!started) {
|
||||||
|
TutorialCanvas.GetComponent<Canvas>().enabled = false;
|
||||||
|
Home.GetComponent<Canvas>().enabled = true;
|
||||||
|
started = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LeaveApp() {
|
||||||
|
Application.Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void YesNoaQuestion(aQuestion aquestion) {
|
||||||
|
GameObject.Find("aQuestion").GetComponent<TMP_Text>().text = aquestion.aquestion;
|
||||||
|
GameObject.Find("AnswerA").GetComponentInChildren<TMP_Text>().text = aquestion.answers[0];
|
||||||
|
GameObject.Find("AnswerB").GetComponentInChildren<TMP_Text>().text = aquestion.answers[1];
|
||||||
|
GameObject.Find("HidingCanva").GetComponent<Canvas>().enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClassicaQuestion(aQuestion aquestion) {
|
||||||
|
GameObject.Find("aQuestion").GetComponent<TMP_Text>().text = aquestion.aquestion;
|
||||||
|
GameObject.Find("HidingCanva").GetComponent<Canvas>().enabled = true;
|
||||||
|
GameObject.Find("AnswerA").GetComponentInChildren<TMP_Text>().text = aquestion.answers[0];
|
||||||
|
GameObject.Find("AnswerB").GetComponentInChildren<TMP_Text>().text = aquestion.answers[1];
|
||||||
|
GameObject.Find("AnswerC").GetComponentInChildren<TMP_Text>().text = aquestion.answers[2];
|
||||||
|
GameObject.Find("AnswerD").GetComponentInChildren<TMP_Text>().text = aquestion.answers[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartQuizz() {
|
||||||
|
Home.GetComponent<Canvas>().enabled = false;
|
||||||
|
aQuestions.GetComponent<Canvas>().enabled = true;
|
||||||
|
aQuestions aquestions = JsonUtility.FromJson<aQuestions>(jsonFile.text);
|
||||||
|
for (int i = 0; i < aquestions.aquestions.Length; i++) {
|
||||||
|
aQuestion aquestion = aquestions.aquestions[i];
|
||||||
|
if (aquestion.type == 0) {
|
||||||
|
ClassicaQuestion(aquestion);
|
||||||
|
} else {
|
||||||
|
YesNoaQuestion(aquestion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Quizz/OLD.cs.meta
Normal file
11
Assets/Scripts/Quizz/OLD.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b4092beca5e50a24d9c6771c5e5eef64
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -20,71 +20,42 @@ public class Questions
|
|||||||
|
|
||||||
public class QuizzManager : MonoBehaviour
|
public class QuizzManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public GameObject LoadingCanvas;
|
public GameObject LauncherScreen;
|
||||||
public GameObject TutorialCanvas;
|
public GameObject GameScreen;
|
||||||
public GameObject Questions;
|
public GameObject Question1;
|
||||||
public GameObject Home;
|
public GameObject Question2;
|
||||||
public TextAsset jsonFile;
|
public GameObject Question3;
|
||||||
private bool launched;
|
|
||||||
private bool started;
|
|
||||||
private int answer_button;
|
|
||||||
|
|
||||||
void Start() {
|
void Start()
|
||||||
LoadingCanvas.GetComponent<Canvas>().enabled = true;
|
{
|
||||||
TutorialCanvas.GetComponent<Canvas>().enabled = false;
|
LauncherScreen.GetComponent<Canvas>().enabled = true;
|
||||||
Questions.GetComponent<Canvas>().enabled = false;
|
GameScreen.GetComponent<Canvas>().enabled = false;
|
||||||
Home.GetComponent<Canvas>().enabled = false;
|
Question1.GetComponent<Canvas>().enabled = true;
|
||||||
launched = false;
|
Question2.GetComponent<Canvas>().enabled = false;
|
||||||
started = false;
|
Question3.GetComponent<Canvas>().enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowTutorial() {
|
public void LaunchGame() {
|
||||||
if (!launched) {
|
LauncherScreen.GetComponent<Canvas>().enabled = false;
|
||||||
LoadingCanvas.GetComponent<Canvas>().enabled = false;
|
GameScreen.GetComponent<Canvas>().enabled = true;
|
||||||
TutorialCanvas.GetComponent<Canvas>().enabled = true;
|
|
||||||
launched = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LaunchQuizz() {
|
public void LeaveQuizz() {
|
||||||
if (!started) {
|
|
||||||
TutorialCanvas.GetComponent<Canvas>().enabled = false;
|
|
||||||
Home.GetComponent<Canvas>().enabled = true;
|
|
||||||
started = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LeaveApp() {
|
public void ToQuestion2() {
|
||||||
Application.Quit();
|
Question1.GetComponent<Canvas>().enabled = false;
|
||||||
|
Question2.GetComponent<Canvas>().enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void YesNoQuestion(Question question) {
|
public void ToQuestion3() {
|
||||||
GameObject.Find("Question").GetComponent<TMP_Text>().text = question.question;
|
Question2.GetComponent<Canvas>().enabled = false;
|
||||||
GameObject.Find("AnswerA").GetComponentInChildren<TMP_Text>().text = question.answers[0];
|
Question3.GetComponent<Canvas>().enabled = true;
|
||||||
GameObject.Find("AnswerB").GetComponentInChildren<TMP_Text>().text = question.answers[1];
|
|
||||||
GameObject.Find("HidingCanva").GetComponent<Canvas>().enabled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClassicQuestion(Question question) {
|
public void ToHome() {
|
||||||
GameObject.Find("Question").GetComponent<TMP_Text>().text = question.question;
|
LauncherScreen.GetComponent<Canvas>().enabled = true;
|
||||||
GameObject.Find("HidingCanva").GetComponent<Canvas>().enabled = true;
|
GameScreen.GetComponent<Canvas>().enabled = false;
|
||||||
GameObject.Find("AnswerA").GetComponentInChildren<TMP_Text>().text = question.answers[0];
|
|
||||||
GameObject.Find("AnswerB").GetComponentInChildren<TMP_Text>().text = question.answers[1];
|
|
||||||
GameObject.Find("AnswerC").GetComponentInChildren<TMP_Text>().text = question.answers[2];
|
|
||||||
GameObject.Find("AnswerD").GetComponentInChildren<TMP_Text>().text = question.answers[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StartQuizz() {
|
|
||||||
Home.GetComponent<Canvas>().enabled = false;
|
|
||||||
Questions.GetComponent<Canvas>().enabled = true;
|
|
||||||
Questions questions = JsonUtility.FromJson<Questions>(jsonFile.text);
|
|
||||||
for (int i = 0; i < questions.questions.Length; i++) {
|
|
||||||
Question question = questions.questions[i];
|
|
||||||
if (question.type == 0) {
|
|
||||||
ClassicQuestion(question);
|
|
||||||
} else {
|
|
||||||
YesNoQuestion(question);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -1,2 +1,2 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 1a7d82f7fad541f78df7016101d3e776
|
guid: 1f8312d9157842a9af56e830533c076e
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<QCARConfig>
|
<QCARConfig>
|
||||||
<Tracking>
|
<Tracking>
|
||||||
|
<ImageTarget name="Na" size="1.000000 1.000000" />
|
||||||
<ImageTarget name="C" size="1.000000 1.000000" />
|
<ImageTarget name="C" size="1.000000 1.000000" />
|
||||||
<ImageTarget name="O" size="1.000000 1.000000" />
|
<ImageTarget name="O" size="1.000000 1.000000" />
|
||||||
<ImageTarget name="H" size="1.000000 1.000000" />
|
<ImageTarget name="H" size="1.000000 1.000000" />
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 7c69adbb1eb240618f9f726726ddbe54
|
guid: 4b6f1d2c047e4730a77d53f36d5d507d
|
||||||
|
8
Assets/TextMesh Pro/Documentation.meta
Normal file
8
Assets/TextMesh Pro/Documentation.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8e7e8f5a82a3a134e91c54efd2274ea9
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf
(Stored with Git LFS)
Normal file
BIN
Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: cc3244f04212efd42b790b18c736d78a
|
guid: 1b8d251f9af63b746bf2f7ffe00ebb9b
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
File diff suppressed because one or more lines are too long
@ -322,6 +322,154 @@ Transform:
|
|||||||
m_CorrespondingSourceObject: {fileID: 4757697444972247267, guid: ae2d2b687aff85b46a01c62e312954d2, type: 3}
|
m_CorrespondingSourceObject: {fileID: 4757697444972247267, guid: ae2d2b687aff85b46a01c62e312954d2, type: 3}
|
||||||
m_PrefabInstance: {fileID: 52111041}
|
m_PrefabInstance: {fileID: 52111041}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1 &73440020
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 73440021}
|
||||||
|
- component: {fileID: 73440024}
|
||||||
|
- component: {fileID: 73440023}
|
||||||
|
- component: {fileID: 73440022}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Na
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &73440021
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 73440020}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 1.329}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 2141458387}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &73440022
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 73440020}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 1778676317, guid: 8a9a760f95896c34689febc965510927, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
mObserverBehaviour: {fileID: 73440024}
|
||||||
|
mHiddenRoot: {fileID: 0}
|
||||||
|
mTargetName: Na
|
||||||
|
mDatasetName: Vuforia/T-VIR.xml
|
||||||
|
mCastedBehaviour: {fileID: 73440024}
|
||||||
|
mMeshFilter: {fileID: 0}
|
||||||
|
mMeshRenderer: {fileID: 0}
|
||||||
|
--- !u!114 &73440023
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 73440020}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 886328de6a5c14cbb85854fdf1a5085b, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
StatusFilter: 0
|
||||||
|
UsePoseSmoothing: 0
|
||||||
|
AnimationCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 3.3333333
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0
|
||||||
|
outWeight: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0.3
|
||||||
|
value: 1
|
||||||
|
inSlope: 3.3333333
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0
|
||||||
|
outWeight: 0
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
OnTargetFound:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 1201501054}
|
||||||
|
m_TargetAssemblyTypeName: ActiveScoppedElements, Assembly-CSharp
|
||||||
|
m_MethodName: AddScoppedElement
|
||||||
|
m_Mode: 5
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument: Na
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
OnTargetLost:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 1201501054}
|
||||||
|
m_TargetAssemblyTypeName: ActiveScoppedElements, Assembly-CSharp
|
||||||
|
m_MethodName: RemoveUnscoppedElement
|
||||||
|
m_Mode: 5
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument: Na
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
--- !u!114 &73440024
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 73440020}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: -1631628248, guid: 8a9a760f95896c34689febc965510927, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
PreviewVisible: 1
|
||||||
|
RuntimeOcclusion: 0
|
||||||
|
RuntimeCollider: 0
|
||||||
|
mTrackableName: Na
|
||||||
|
mInitializedInEditor: 1
|
||||||
|
mDataSetPath: Vuforia/T-VIR.xml
|
||||||
|
mAspectRatio: 1
|
||||||
|
mImageTargetType: 0
|
||||||
|
mWidth: 1
|
||||||
|
mHeight: 1
|
||||||
|
mRuntimeTexture: {fileID: 0}
|
||||||
|
mMotionHint: 1
|
||||||
|
mTrackingOptimization: 0
|
||||||
|
mTrackingOptimizationNeedsUpgrade: 0
|
||||||
|
mPreview: {fileID: 73440022}
|
||||||
--- !u!1 &239149474
|
--- !u!1 &239149474
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -4808,6 +4956,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 2082618016}
|
- {fileID: 2082618016}
|
||||||
|
- {fileID: 73440021}
|
||||||
- {fileID: 1305875256}
|
- {fileID: 1305875256}
|
||||||
- {fileID: 1576193661}
|
- {fileID: 1576193661}
|
||||||
- {fileID: 2115541903}
|
- {fileID: 2115541903}
|
||||||
|
7
Assets/__Scenes/tmp.unity.meta
Normal file
7
Assets/__Scenes/tmp.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2c5db3808697d5d42bef016039ab3370
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/script/Atome.meta
Normal file
8
Assets/script/Atome.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d277baeb8e7f7794fb44493815552a02
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
139
Assets/script/Atome/AtomeFactory.cs
Normal file
139
Assets/script/Atome/AtomeFactory.cs
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
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 bool hasAtome(String symbol)
|
||||||
|
{
|
||||||
|
return AtomeDictionary.ContainsKey(symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
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.03f; // 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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,55 +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 bool hasAtome(String symbol)
|
|
||||||
{
|
|
||||||
return AtomeDictionary.ContainsKey(symbol);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public AtomeInformation createAtome(string symbol){
|
|
||||||
if(!AtomeDictionary.ContainsKey(symbol)){
|
|
||||||
Debug.LogError("Atome does not existe in json");
|
|
||||||
}
|
|
||||||
AtomeInformation atome = AtomeDictionary[symbol];
|
|
||||||
|
|
||||||
return atome;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -11,14 +11,14 @@ class MoleculeFactoryTester: MonoBehaviour {
|
|||||||
public TextAsset atomJson;
|
public TextAsset atomJson;
|
||||||
|
|
||||||
void Start(){
|
void Start(){
|
||||||
MoleculeFactory factory = MoleculeFactory.getInstrance(this.moleculeJson);
|
/*MoleculeFactory factory = MoleculeFactory.getInstrance(this.moleculeJson);
|
||||||
AtomeFactory atomeFactory = AtomeFactory.getInstrance(this.atomJson);
|
AtomeFactory atomeFactory = AtomeFactory.getInstrance(this.atomJson);
|
||||||
factory.setAtomFactory(atomeFactory);
|
factory.setAtomFactory(atomeFactory);
|
||||||
GameObject mol = factory.createMolecule("O2");
|
GameObject mol = factory.createMolecule("O2");
|
||||||
GameObject mol2 = factory.createMolecule("H2O");
|
GameObject mol2 = factory.createMolecule("H2O");
|
||||||
mol.transform.position = new Vector3(0,1,0);
|
mol.transform.position = new Vector3(0,1,0);
|
||||||
GameObject mol3 = factory.createMolecule("C4H10");
|
GameObject mol3 = factory.createMolecule("C4H10");
|
||||||
mol3.transform.position = new Vector3(0,5,0);
|
mol3.transform.position = new Vector3(0,5,0);*/
|
||||||
//GameObject bon = GameOject.CreatePrimitive(PrimitiveType.)
|
//GameObject bon = GameOject.CreatePrimitive(PrimitiveType.)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
Assets/script/Molecule.meta
Normal file
8
Assets/script/Molecule.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: daab5552b7014024c9b81a31c7eb0b12
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
53
Assets/script/New Animation.anim
Normal file
53
Assets/script/New Animation.anim
Normal 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: []
|
8
Assets/script/New Animation.anim.meta
Normal file
8
Assets/script/New Animation.anim.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3f4a98ccdd3a2514495ffff7ef525aa7
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 7400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
12
Assets/script/New Animator Controller.controller
Normal file
12
Assets/script/New Animator Controller.controller
Normal 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: []
|
8
Assets/script/New Animator Controller.controller.meta
Normal file
8
Assets/script/New Animator Controller.controller.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 825a7187bec92284dbce290965de4dba
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 9100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
21
README.md
21
README.md
@ -1,9 +1,22 @@
|
|||||||
# T-VIR-901
|
# T-VIR-901
|
||||||
|
|
||||||
> Unity Editor version to use: Unity 2022.3.11f1
|
> Unity Editor version à utiliser: Unity 2022.3.11f1
|
||||||
|
|
||||||
## Installation
|
Github mirroir (https://github.com/EpitechMscProPromo2024/T-VIR-901-NAN_1)
|
||||||
|
|
||||||
## Configuration
|
## Accès à l'application
|
||||||
|
|
||||||
|
L'application est maintenant accessible sur le Play Store en tant qu'application bêta ouverte destinée aux testeurs internes. Pour y accéder, veuillez faire une demande pour être ajouté à la liste des testeurs bêta en contactant l'un des développeurs suivants :
|
||||||
|
|
||||||
|
- Nicolas SANS (nicolas.sansd@gmail.com)
|
||||||
|
- Mathis RAGOT (mathis.ragot@epitech.eu)
|
||||||
|
- Clément BOESMIER (clement.boesmier@epitech.eu)
|
||||||
|
- Gildas GONZALEZ (gildas.gonzalez@epitech.eu)
|
||||||
|
|
||||||
|
Une fois l'accès accordé, vous pouvez retrouver l'application en suivant ce lien :
|
||||||
|
https://play.google.com/store/apps/details?id=com.DefaultCompany.TVIR901
|
||||||
|
|
||||||
|
|
||||||
|
Lien des QRCodes pour afficher les molécules et atomes
|
||||||
|
https://drive.google.com/drive/folders/1DhQNkJQinPD4lftVDK2BHNPfEnNlAMOX?usp=sharing
|
||||||
|
|
||||||
## License
|
|
Reference in New Issue
Block a user