Example #1
0
        private void Validate()
        {
            if (atomPreview == null || validationLight == null || spawnPoint == null)
            {
                return;
            }

            foreach (AtomPack atom in atoms)
            {
                if (atom.Neutrons == GetCount(AtomPart.Neutron) && atom.Protons == GetCount(AtomPart.Proton) &&
                    atom.Electrons == GetCount(AtomPart.Electron))
                {
                    validationLight.material.SetColor("_EmissionColor", Color.green);
                    atomPreview.material.color = validColor;
                    atomPreview.material.SetTexture("_MainTex",
                                                    atom.gameObject.GetComponent <Renderer>().sharedMaterial.GetTexture("_MainTex"));
                    current = atom;
                    return;
                }
            }

            atomPreview.material.color = invalidColor;
            validationLight.material.SetColor("_EmissionColor", Color.red);
            current = null;
        }
        private void OnTriggerEnter(Collider other)
        {
            AtomPack atom = other.GetComponent <AtomPack>();

            if (atom)
            {
                builder.AddAtom(atom);
                Destroy(atom.gameObject, destroyTimeout);
            }
        }
Example #3
0
        public void ResetAtom()
        {
            contents.Clear();
            visualization.Reset();

            atomPreview.material.color = invalidColor;
            validationLight.material.SetColor("_EmissionColor", Color.red);
            if (electronsLabel != null)
            {
                electronsLabel.text = $"Electrons: 0";
            }
            if (neutronsLabel != null)
            {
                neutronsLabel.text = $"Neutrons: 0";
            }
            if (protonsLabel != null)
            {
                protonsLabel.text = $"Protons: 0";
            }
            current = null;
        }
 public void AddAtom(AtomPack atom)
 {
     contents.Add(new AtomPack(atom));
     RefreshScreen();
 }