diff --git a/Assets/Buffet Table/Image Prefabs/Gamma.prefab b/Assets/Buffet Table/Image Prefabs/Gamma.prefab new file mode 100644 index 00000000..27a30885 --- /dev/null +++ b/Assets/Buffet Table/Image Prefabs/Gamma.prefab @@ -0,0 +1,139 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8006402977536635982 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2135732722106203458} + - component: {fileID: 6132841249056728844} + - component: {fileID: 8172981974303022031} + - component: {fileID: 6055098838179665480} + - component: {fileID: 1638071961686837473} + m_Layer: 0 + m_Name: Gamma + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2135732722106203458 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8006402977536635982} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -15} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -15.05, y: 0.08} + m_SizeDelta: {x: 9, y: 9} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6132841249056728844 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8006402977536635982} + m_CullTransparentMesh: 0 +--- !u!114 &8172981974303022031 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8006402977536635982} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 21300000, guid: 9407a53847906704598fbcb1611ba986, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!212 &6055098838179665480 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8006402977536635982} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 9407a53847906704598fbcb1611ba986, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 9, y: 9} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1638071961686837473 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8006402977536635982} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1d3e7c246620578488479fc2e161e0c7, type: 3} + m_Name: + m_EditorClassIdentifier: + sphereToFollow: {fileID: 0} diff --git a/Assets/Buffet Table/Image Prefabs/Gamma.prefab.meta b/Assets/Buffet Table/Image Prefabs/Gamma.prefab.meta new file mode 100644 index 00000000..85ee2b68 --- /dev/null +++ b/Assets/Buffet Table/Image Prefabs/Gamma.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8315f809954548849a00d367e96f4d34 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Buffet Table/Image Prefabs/Zero.prefab b/Assets/Buffet Table/Image Prefabs/Zero.prefab new file mode 100644 index 00000000..69d92edf --- /dev/null +++ b/Assets/Buffet Table/Image Prefabs/Zero.prefab @@ -0,0 +1,139 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8526863496484344483 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6607910320808845062} + - component: {fileID: 2099319776012936699} + - component: {fileID: 7746644101679292531} + - component: {fileID: 2462606199636594406} + - component: {fileID: 4967449586410954121} + m_Layer: 0 + m_Name: Zero + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6607910320808845062 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8526863496484344483} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 2.6842406, y: 1.8127503} + m_SizeDelta: {x: 12, y: 12} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!212 &2099319776012936699 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8526863496484344483} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: b9f22128f2aec6641bdf83ded7e5bebb, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 12, y: 12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!222 &7746644101679292531 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8526863496484344483} + m_CullTransparentMesh: 0 +--- !u!114 &2462606199636594406 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8526863496484344483} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 21300000, guid: b9f22128f2aec6641bdf83ded7e5bebb, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!114 &4967449586410954121 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8526863496484344483} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1d3e7c246620578488479fc2e161e0c7, type: 3} + m_Name: + m_EditorClassIdentifier: + sphereToFollow: {fileID: 0} diff --git a/Assets/Buffet Table/Image Prefabs/Zero.prefab.meta b/Assets/Buffet Table/Image Prefabs/Zero.prefab.meta new file mode 100644 index 00000000..f1d0ce20 --- /dev/null +++ b/Assets/Buffet Table/Image Prefabs/Zero.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 510780d5c8db4f443a0df858bd24b975 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Buffet Table/Image Prefabs/gamma-radiation.jpg b/Assets/Buffet Table/Image Prefabs/gamma-radiation.jpg new file mode 100644 index 00000000..a80f0c11 Binary files /dev/null and b/Assets/Buffet Table/Image Prefabs/gamma-radiation.jpg differ diff --git a/Assets/Buffet Table/Image Prefabs/gamma-radiation.jpg.meta b/Assets/Buffet Table/Image Prefabs/gamma-radiation.jpg.meta new file mode 100644 index 00000000..df5442bf --- /dev/null +++ b/Assets/Buffet Table/Image Prefabs/gamma-radiation.jpg.meta @@ -0,0 +1,88 @@ +fileFormatVersion: 2 +guid: 9407a53847906704598fbcb1611ba986 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: ec323844b14d12f46bc89244414d25e0 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Buffet Table/Image Prefabs/zero.png b/Assets/Buffet Table/Image Prefabs/zero.png new file mode 100644 index 00000000..59d29b2b Binary files /dev/null and b/Assets/Buffet Table/Image Prefabs/zero.png differ diff --git a/Assets/Buffet Table/Image Prefabs/zero.png.meta b/Assets/Buffet Table/Image Prefabs/zero.png.meta new file mode 100644 index 00000000..693cfbe1 --- /dev/null +++ b/Assets/Buffet Table/Image Prefabs/zero.png.meta @@ -0,0 +1,88 @@ +fileFormatVersion: 2 +guid: b9f22128f2aec6641bdf83ded7e5bebb +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 740874a66f889394f9ea4b57591846c9 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IC2020.cs b/Assets/IC2020.cs index 26720cea..4db9287e 100644 --- a/Assets/IC2020.cs +++ b/Assets/IC2020.cs @@ -12,6 +12,7 @@ - class "Particle" is a class used to design particles and then spawn them at will. - class "ParticleSpawner" is a class used to spawn water molecules (and eventually more molecules too). - static class "ICColor" is a class that holds all of the colors of particles used in IC2020. +- use a gun to launch the particles together */ using System; @@ -44,6 +45,10 @@ public static class ICColor public static Color Magnesium = new Color32(42, 128, 42, 255); public static Color Calcium = new Color32(128, 128, 128, 255); public static Color Potassium = new Color32(255, 20, 147, 255); + public static Color Deuterium = new Color32(255, 182, 193, 255); + public static Color HeliumIsotope = new Color32(238, 221, 130, 255); + public static Color Neutrino = new Color32(255, 0, 0, 255); + public static Color HeliumIsotope4 = new Color32(255, 165, 0, 255); } public class Particle diff --git a/Assets/ImageFollower.cs b/Assets/ImageFollower.cs index c30a56f0..a1dea3fa 100644 --- a/Assets/ImageFollower.cs +++ b/Assets/ImageFollower.cs @@ -15,8 +15,8 @@ void Start() // Update is called once per frame void Update() { - //Convert the player's position to the UI space then apply the offset - transform.position = worldToUISpace(lableCanvas.GetComponent(), sphereToFollow.transform.position); + //Convert the player's position to the UI space then apply the offset + transform.position = worldToUISpace(lableCanvas.GetComponent(), sphereToFollow.transform.position); } private Vector3 worldToUISpace(Canvas parentCanvas, Vector3 worldPos) diff --git a/Assets/ModelSlector.cs b/Assets/ModelSlector.cs index da4e0947..a77f19d7 100644 --- a/Assets/ModelSlector.cs +++ b/Assets/ModelSlector.cs @@ -3,6 +3,7 @@ using UnityEngine; using UnityEngine.UI; using IC2020; +using System; public class ModelSlector : MonoBehaviour { @@ -93,10 +94,12 @@ public void ChooseModel() //... else if (dropDownValue == 4) - { - //do stuff here + { dropDownMenu.GetComponent().value = 0; pannel.SetActive(false); + GameObject.Find("GameObject").AddComponent(); + float k = GameObject.Find("GameObject").GetComponent
().k; + GameObject.Find("GameObject").GetComponent().initialize(1, k); } } diff --git a/Assets/MoleculeType.cs b/Assets/MoleculeType.cs new file mode 100644 index 00000000..cc71f3f0 --- /dev/null +++ b/Assets/MoleculeType.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class MoleculeType : MonoBehaviour +{ + public string ParticleType = null; + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/MoleculeType.cs.meta b/Assets/MoleculeType.cs.meta new file mode 100644 index 00000000..22ad548c --- /dev/null +++ b/Assets/MoleculeType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d4429854e5ba1ab4cb53dfa9361ff377 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NuclearSimulation.cs b/Assets/NuclearSimulation.cs new file mode 100644 index 00000000..78082ac8 --- /dev/null +++ b/Assets/NuclearSimulation.cs @@ -0,0 +1,326 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using IC2020; +using System; +using UnityEngine.UI; +using UnityEditor; + +public class NuclearSimulation : MonoBehaviour +{ + private List StartPosition = new List(); + // An object in the scene is stored in CurrentObjects + public List CurrentObjects = new List(); + public List CurrentlyInactive = new List(); + bool SecondRound = false; // the second round of producing Helium-3 + bool FinalCollisionRound = false; // colliding two Helium-3 molecules in the final stage + bool CollisionNotRegistered = true; + + // Start is called before the first frame update + void Start() + { + List Names = new List() + { + "Hydrogen", + "Deuterium", + "Helium-3", + "Helium-4", + "Beta Particle", + "Neutrino" + }; + + List ParticleColors = new List() + { + ICColor.Hydrogen, + ICColor.Deuterium, + ICColor.HeliumIsotope, + ICColor.HeliumIsotope4, + ICColor.Electron, + ICColor.Neutrino + }; + + GameObject BTPanel = GameObject.Find("Buffet Table").transform.GetChild(0).gameObject; + + for (int idx = 0; idx < BTPanel.transform.childCount; idx++) + { + GameObject BTElement = BTPanel.transform.GetChild(idx).gameObject; + + if (BTElement.name == "Tile" + (idx - 1)) + { + GameObject Indicator = BTElement.transform.GetChild(0).gameObject; + GameObject Name = BTElement.transform.GetChild(1).gameObject; + + Name.GetComponent().text = Names[idx - 1]; + + Indicator.GetComponent().sprite = AssetDatabase.GetBuiltinExtraResource("UI/Skin/Knob.psd"); + Indicator.GetComponent().color = ParticleColors[idx - 1]; + Indicator.GetComponent().sizeDelta = new Vector2(50, 50); + + GameObject.Destroy(Indicator.GetComponent()); + } + } + + // Going back to the first design: fixing the starting positions of the protons + StartPosition.Add(new Vector3(-7f, 7f)); + StartPosition.Add(new Vector3(0f, -7f)); + StartPosition.Add(new Vector3(7f, 7f)); + + // Also the first solution: giving each proton an incredible mass + for (int x = 0; x < 3; x++) + { + Particle Proton = new Particle("Hydrogen " + x, 2f, ICColor.Hydrogen, mass: 100000f, scale: 2f); + GameObject ProtonGO = Proton.Spawn(); + ProtonGO.tag = "Hydrogen"; + ProtonGO.transform.position = StartPosition[x % 3]; + CurrentObjects.Add(ProtonGO); + } + } + + // Update is called once per frame + void Update() + { + + } + + private void FixedUpdate() + { + for (int AIdx = 0; AIdx < CurrentObjects.Count; AIdx++) + { + for (int BIdx = 0; BIdx < CurrentObjects.Count; BIdx++) + { + GameObject a = CurrentObjects[AIdx]; + GameObject b = CurrentObjects[BIdx]; + if (a != b) + { + // there is no way to detect a collision without adding a component to each GO + float ObjRadius = a.GetComponent().radius * a.transform.localScale.x; // sphere must have identical scale in each direction + if (Math.Abs(Vector3.Distance(a.transform.position, b.transform.position) - 2 * ObjRadius) <= .25f) + { + // Scenario 1: Two protons, not part of any molecule, have collided + if (a.tag == "Hydrogen" && b.tag == "Hydrogen") + { + // Join the protons to form deuterium + a.AddComponent().connectedBody = b.GetComponent(); + a.tag = "Deuterium"; + b.tag = "Deuterium"; + b.name = "[P] Neutron " + b.name.Split(' ')[2]; + b.GetComponent().charge = 0f; + DestroyLableFollower(b); + // '0' designates neutral charge + AddLabel(b, 3); + ChangeColor(0); + + Particle Neutrino = new Particle("Neutrino", 0f, ICColor.Neutrino, mass: 0f); + GameObject NeutrinoGO = Neutrino.Spawn(); + DestroyLableFollower(NeutrinoGO); + AddLabel(NeutrinoGO, 3); + + Particle Beta = new Particle("Beta", 2f, ICColor.Electron, mass: 0f); + GameObject BetaGO = Beta.Spawn(); + + // the beta and neutrino cannot be deleted immediately after their creation + // the coroutine I created deletes them after 2s + StartCoroutine(DeleteBetaNeutrino(BetaGO, NeutrinoGO)); + } + + // Scenario 2: A particle in deuterium and a free proton have collided + else if (a.tag == "Deuterium" && b.tag == "Hydrogen") + { + a.tag = "3Helium"; + b.tag = "3Helium"; + + a.AddComponent().connectedBody = b.GetComponent(); + + // all three particles are part of Helium-3 + for (int idx = 0; idx < CurrentObjects.Count; idx++) + { + GameObject GO = CurrentObjects[idx]; + if (GO != a && GO != b) + { + GO.tag = "3Helium"; + } + } + + ChangeColor(1); + + Particle Gamma = new Particle("Gamma", 0f, ICColor.Neutrino, mass: 0f); + GameObject GammaGO = Gamma.Spawn(); + DestroyLableFollower(GammaGO); + AddLabel(GammaGO, 4, true, new Vector3(3f, 3f)); + + StartCoroutine(DeleteGamma(GammaGO)); + StartCoroutine("ResetNew3Helium"); + } + + // Final case: two Helium-3 isotopes have collided + else if (a.tag == "3Helium" && b.tag == "3Helium" && FinalCollisionRound && CollisionNotRegistered) + { + CollisionNotRegistered = false; + + for (int idx = 0; idx < CurrentObjects.Count; idx++) + { + DestroyLableFollower(CurrentObjects[idx]); + CurrentObjects[idx].SetActive(false); + } + + GameObject PrevObject = null; + + for (int idx = 0; idx < 4; idx++) + { + Particle Hydrogen = new Particle("Hydrogen " + (idx + 6), 2f, ICColor.HeliumIsotope4, scale: 2f); + GameObject HydrogenGO = Hydrogen.Spawn(); + + // 2 protons, 2 neutrons in Helium-4 + if (idx > 1) + { + DestroyLableFollower(HydrogenGO); + AddLabel(HydrogenGO, 3); + HydrogenGO.name = "[P] Neutron " + HydrogenGO.name.Split(' ')[2]; + } + + if (!(PrevObject == null)) + { + HydrogenGO.AddComponent().connectedBody = PrevObject.GetComponent(); + } + + PrevObject = HydrogenGO; + } + + Particle StdHydrogen = new Particle("Hydrogen 11", 2f, ICColor.Hydrogen, scale: 2f); + StdHydrogen.Spawn(); + + Particle StdHydrogen2 = new Particle("Hydrogen 12", 2f, ICColor.Hydrogen, scale: 2f); + StdHydrogen2.Spawn(); + } + } + } + } + } + + } + + private void DestroyLableFollower(GameObject ObjToRemoveLabel) + { + // This codebase implements labels (e.g. +) as GameObjects following particles + // This method removes the label follower that follows ObjToRemoveLabel + Transform ChildrenList = GameObject.Find("Lable Canvas").transform; + for (int x = 0; x < ChildrenList.childCount; x++) + { + Transform child = ChildrenList.GetChild(x); + if (child.gameObject.GetComponent().sphereToFollow == ObjToRemoveLabel) + { + GameObject.Destroy(child.gameObject); + } + } + } + + private void AddLabel(GameObject ObjToAddLabel, int LabelIdx, bool UsingScale = false, Vector3 scale = new Vector3()) + { + if (LabelIdx < (GameObject.Find("Lable Canvas").GetComponent().imagePrefabs.Length)) + { + GameObject Lable = MonoBehaviour.Instantiate(GameObject.Find("Lable Canvas").GetComponent().imagePrefabs[LabelIdx], Vector3.zero, Quaternion.identity); + if (UsingScale) + { + Lable.transform.localScale = scale; + } + Lable.transform.SetParent(GameObject.Find("Lable Canvas").transform, false); + Lable.GetComponent().sphereToFollow = ObjToAddLabel; + } + } + + private void ChangeColor(int MoleculeColorIdx) + { + // When certain molecules are formed, atoms must be colored in certain ways + // Colors assigned based on ParticleType variable of MoleculeType component + for (int x = 0; x < CurrentObjects.Count; x++) + { + GameObject GO = CurrentObjects[x]; + if (GO.tag == "Deuterium" && MoleculeColorIdx == 0) + { + GO.GetComponent().material.color = ICColor.Deuterium; + } + + else if (GO.tag == "3Helium" && MoleculeColorIdx == 1) + { + GO.GetComponent().material.color = ICColor.HeliumIsotope; + } + } + + } + + IEnumerator ResetNew3Helium() + { + // When Deuterium collides with a proton, and the He-3 isotope is formed, the process must restart + // Restarts after a 2s delay + yield return new WaitForSeconds(2f); + if (!SecondRound) + { + SecondRound = true; + for (int idx = 0; idx < 3; idx++) + { + CurrentObjects[idx].SetActive(false); + DestroyLableFollower(CurrentObjects[idx]); + CurrentlyInactive.Add(CurrentObjects[idx]); + } + + CurrentObjects.Clear(); + + for (int idx = 0; idx < 3; idx++) + { + Particle Proton = new Particle("Hydrogen " + (idx + 3), 2f, ICColor.Hydrogen, mass: 100000f, scale: 2f); + GameObject ProtonGO = Proton.Spawn(); + ProtonGO.transform.position = StartPosition[idx % 3]; + ProtonGO.tag = "Hydrogen"; + CurrentObjects.Add(ProtonGO); + } + } + // Second round + else + { + // simpler alternative to temporarily stop motion to position new particles + float OldTimeScale = Time.timeScale; + Time.timeScale = 0f; + + for (int idx = 0; idx < 3; idx++) + { + // change position and status + CurrentObjects[idx].transform.position = StartPosition[1] + idx * new Vector3(1f, 1f); + CurrentlyInactive[idx].transform.position = StartPosition[2] - idx * new Vector3(1f, 1f); + CurrentlyInactive[idx].SetActive(true); + + if (CurrentlyInactive[idx].name.Split(' ')[1] == "Hydrogen") + { + AddLabel(CurrentlyInactive[idx], 0); + } + else + { + AddLabel(CurrentlyInactive[idx], 3); + } + CurrentObjects.Add(CurrentlyInactive[idx]); + } + + CurrentlyInactive.Clear(); + FinalCollisionRound = true; + + yield return new WaitForSeconds(2f); + Time.timeScale = OldTimeScale; + } + } + + IEnumerator DeleteBetaNeutrino(GameObject Beta, GameObject Neutrino) + { + // Deleting GameObjects after a time interval is difficult -- associated labels must be removed + yield return new WaitForSeconds(2f); + DestroyLableFollower(Beta); + Beta.SetActive(false); + DestroyLableFollower(Neutrino); + Neutrino.SetActive(false); + } + + IEnumerator DeleteGamma(GameObject Gamma) + { + yield return new WaitForSeconds(2f); + DestroyLableFollower(Gamma); + Gamma.SetActive(false); + } +} diff --git a/Assets/NuclearSimulation.cs.meta b/Assets/NuclearSimulation.cs.meta new file mode 100644 index 00000000..0bd12ce9 --- /dev/null +++ b/Assets/NuclearSimulation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c40a636ab67b8dc44b3a3d48511d2a3e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/base.unity b/Assets/Scenes/base.unity index 6b4c7c51..27a642e1 100644 --- a/Assets/Scenes/base.unity +++ b/Assets/Scenes/base.unity @@ -1467,6 +1467,8 @@ MonoBehaviour: - {fileID: 1778059490039022324, guid: 43691fde131ee4143b8d7f1568678636, type: 3} - {fileID: 8520551613667858557, guid: b4d9ba947cdb3894fbb66450481d9f9b, type: 3} - {fileID: 8520551613667858557, guid: a6098b3de202abf45832b953cbc0f9ed, type: 3} + - {fileID: 8526863496484344483, guid: 510780d5c8db4f443a0df858bd24b975, type: 3} + - {fileID: 8006402977536635982, guid: 8315f809954548849a00d367e96f4d34, type: 3} --- !u!1 &428324403 GameObject: m_ObjectHideFlags: 0 @@ -2320,17 +2322,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: cf9c39c330c410642b32365f389ae0f1, type: 3} m_Name: m_EditorClassIdentifier: - m_Name: - m_EditorClassIdentifier: - m_Name: - m_EditorClassIdentifier: - m_Name: - m_EditorClassIdentifier: - m_Name: - m_EditorClassIdentifier: - m_Name: - m_EditorClassIdentifier: - speed: {fileID: 0} --- !u!114 &727737757 MonoBehaviour: m_ObjectHideFlags: 0 @@ -5318,7 +5309,7 @@ MonoBehaviour: m_Image: {fileID: 0} - m_Text: Na+ in Water m_Image: {fileID: 0} - - m_Text: '...' + - m_Text: Nucleosynthesis m_Image: {fileID: 0} m_OnValueChanged: m_PersistentCalls: diff --git a/Assets/main.cs b/Assets/main.cs index 6fbabeeb..69cf9562 100644 --- a/Assets/main.cs +++ b/Assets/main.cs @@ -13,7 +13,7 @@ public class main : MonoBehaviour private void Start() { - // Initializes forces - gameObject.AddComponent().initialize(G, k); + // Initializes forces + gameObject.AddComponent().initialize(G, k); } } \ No newline at end of file diff --git a/Assets/time.cs b/Assets/time.cs index ff6efea5..5af2431b 100644 --- a/Assets/time.cs +++ b/Assets/time.cs @@ -7,29 +7,28 @@ public class time : MonoBehaviour { Text speed; - - public void updateTimeScale(float scale) - { - GameObject.Find("speedText").GetComponent().text = "Speed: " + (scale/4).ToString() + "x"; - if(scale < 0) - { - if(GameObject.Find("GameObject").GetComponent().frame == -1) - { - Time.timeScale = 0f; - GetComponent().value = 0; - } - else - { - GameObject.Find("GameObject").GetComponent().startRewind(); - Time.timeScale = Math.Abs(scale/4); - GetComponent().value = scale; - } - } - else - { - Time.timeScale = scale/4; - GetComponent().value = scale; - GameObject.Find("GameObject").GetComponent().stopRewind(); - } - } + + public void updateTimeScale(float scale) + { + GameObject.Find("speedText").GetComponent().text = "Speed: " + (scale/4).ToString() + "x"; + if (scale < 0) { + if (GameObject.Find("GameObject").GetComponent().frame == -1) + { + Time.timeScale = 0f; + GetComponent().value = 0; + } + else + { + GameObject.Find("GameObject").GetComponent().startRewind(); + Time.timeScale = Math.Abs(scale/4); + GetComponent().value = scale; + } + } + else + { + Time.timeScale = scale/4; + GetComponent().value = scale; + GameObject.Find("GameObject").GetComponent().stopRewind(); + } + } } diff --git a/Logs/Packages-Update.log b/Logs/Packages-Update.log new file mode 100644 index 00000000..6a6ba9e1 --- /dev/null +++ b/Logs/Packages-Update.log @@ -0,0 +1,43 @@ + +=== Mon Mar 16 16:03:19 2020 + +Packages were changed. +Update Mode: resetToDefaultDependencies + +The following packages were added: + com.unity.analytics@3.2.2 + com.unity.purchasing@2.0.3 + com.unity.ads@2.0.8 + com.unity.textmeshpro@1.3.0 + com.unity.package-manager-ui@2.0.7 + com.unity.collab-proxy@1.2.15 + com.unity.modules.ai@1.0.0 + com.unity.modules.animation@1.0.0 + com.unity.modules.assetbundle@1.0.0 + com.unity.modules.audio@1.0.0 + com.unity.modules.cloth@1.0.0 + com.unity.modules.director@1.0.0 + com.unity.modules.imageconversion@1.0.0 + com.unity.modules.imgui@1.0.0 + com.unity.modules.jsonserialize@1.0.0 + com.unity.modules.particlesystem@1.0.0 + com.unity.modules.physics@1.0.0 + com.unity.modules.physics2d@1.0.0 + com.unity.modules.screencapture@1.0.0 + com.unity.modules.terrain@1.0.0 + com.unity.modules.terrainphysics@1.0.0 + com.unity.modules.tilemap@1.0.0 + com.unity.modules.ui@1.0.0 + com.unity.modules.uielements@1.0.0 + com.unity.modules.umbra@1.0.0 + com.unity.modules.unityanalytics@1.0.0 + com.unity.modules.unitywebrequest@1.0.0 + com.unity.modules.unitywebrequestassetbundle@1.0.0 + com.unity.modules.unitywebrequestaudio@1.0.0 + com.unity.modules.unitywebrequesttexture@1.0.0 + com.unity.modules.unitywebrequestwww@1.0.0 + com.unity.modules.vehicles@1.0.0 + com.unity.modules.video@1.0.0 + com.unity.modules.vr@1.0.0 + com.unity.modules.wind@1.0.0 + com.unity.modules.xr@1.0.0 diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 48f795c9..286988f0 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -5,6 +5,9 @@ TagManager: serializedVersion: 2 tags: - Water + - Hydrogen + - Deuterium + - 3Helium layers: - Default - TransparentFX diff --git a/UpgradeLog.htm b/UpgradeLog.htm new file mode 100644 index 00000000..42889cec Binary files /dev/null and b/UpgradeLog.htm differ