Beispiel #1
0
    public void GrabObject(GameObject closeObject)
    {
        //  StartCoroutine(MoveOverSeconds(closeObject, grabPosition.transform.position, .25f));

        // Notify tractored object that it has been grabbed.
        // This is used to start an audio tutorial.
        closeObject.SendMessage("OnGrab", null, SendMessageOptions.DontRequireReceiver);

        grabJoint.connectedBody       = closeObject.GetComponent <Rigidbody>();
        previousGrabbedObjectPosition = grabJoint.connectedBody.gameObject.transform.position;


        AtomScript atom = closeObject.GetComponent <AtomScript> ();

        if (atom != null && atom.getMoleculeNameSound() != moleculeNameCooldown)
        {
            atom.playMoleculeNameSound();
            moleculeNameCooldown = atom.getMoleculeNameSound();
        }


        if (closeObject.tag == "Pistol")
        {
            isHoldingTool = true;
        }
    }
Beispiel #2
0
        public MapInfo(AtomScript Script)
            : base(Script)
        {
            this.Inputs.Add("Get", new Input(this, ConnectionType.Void));

            this.Outputs.Add("Name", new Output(this, ConnectionType.Int));
            this.Outputs.Add("TotalPlanets", new Output(this, ConnectionType.Int));
        }
Beispiel #3
0
    //Form bonds where the two atoms currently are
    public void formBond(GameObject startAtom, GameObject endAtom, int bondOrder)
    {
        Rigidbody endAtomRB   = endAtom.GetComponent <Rigidbody> ();
        Rigidbody startAtomRB = startAtom.GetComponent <Rigidbody> ();

        AtomScript endAtomScript = endAtom.GetComponent <AtomScript>();



        CharacterJoint joint1 = startAtom.AddComponent <CharacterJoint> ();

        joint1.connectedBody = endAtomRB;

        joint1.breakForce = 1000f * bondOrder;

        SoftJointLimit jointLowLimit = new SoftJointLimit();

        jointLowLimit.limit = -180;

        SoftJointLimit jointHighLimit = new SoftJointLimit();

        jointHighLimit.limit = 180;



        CharacterJoint joint2 = endAtom.AddComponent <CharacterJoint> ();

        joint2.connectedBody = startAtomRB;

        joint2.breakForce = 1000f * bondOrder;

        setConnectedAtoms(startAtom, endAtom);


        if (bondOrder == 1)
        {
            /*
             * joint1.lowTwistLimit = jointLowLimit;
             * joint1.highTwistLimit = jointHighLimit;
             *
             * joint2.lowTwistLimit = jointLowLimit;
             * joint2.highTwistLimit = jointHighLimit;*/
            //joint1.swing2Limit = jointHighLimit;
            //joint2.swing2Limit = jointHighLimit;

            //joint1.swing1Limit = jointHighLimit;
            //joint2.swing1Limit = jointHighLimit;
        }

        orderModifier = bondOrder;
        stubBondReferenceStartAtom = startAtom.GetComponent <AtomScript> ().makeBondConnection(endAtom, gameObject, bondOrder);
        stubBondReferenceStartAtom.Add(startAtom);

        stubBondReferenceEndAtom = endAtom.GetComponent <AtomScript> ().makeBondConnection(startAtom, gameObject, bondOrder);
        stubBondReferenceEndAtom.Add(endAtom);
        //gameObject.transform.parent = startAtom.transform;
    }
Beispiel #4
0
 public GetPlanets(AtomScript script)
     : base(script)
 {
     this.Inputs.Add("Player", new Input(this, ConnectionType.Int));
     this.Inputs.Add("IncludeMy", new Input(this, ConnectionType.Bool));
     this.Inputs.Add("IncludeEnemy", new Input(this, ConnectionType.Bool));
     this.Inputs.Add("IncludeNeutral", new Input(this, ConnectionType.Bool));
     this.Inputs.Add("Get", new Input(this, ConnectionType.Void));
     this.Inputs.Add("Next", new Input(this, ConnectionType.Void));
     this.Outputs.Add("For Each", new Output(this, ConnectionType.Int));
 }
Beispiel #5
0
        public SendFleet(AtomScript Script)
            : base(Script)
        {
            this.Inputs.Add("Forces", new Input(this, ConnectionType.Int));
            this.Inputs.Add("Owner", new Input(this, ConnectionType.Int));
            this.Inputs.Add("Position", new Input(this, ConnectionType.Vector2));
            this.Inputs.Add("Source", new Input(this, ConnectionType.Int));
            this.Inputs.Add("Distination", new Input(this, ConnectionType.Int));
            this.Inputs.Add("Send", new Input(this, ConnectionType.Void));

            this.Outputs.Add("Done", new Output(this, ConnectionType.Void));
        }
Beispiel #6
0
        public OnScriptLoadedNode(AtomScript Script)
            : base(Script)
        {
            this.Inputs.Add("ID", new Input(this, ConnectionType.Int));
            this.Inputs.Add("Owner", new Input(this, ConnectionType.Int));
            this.Inputs.Add("Forces", new Input(this, ConnectionType.Int));
            this.Inputs.Add("Position", new Input(this, ConnectionType.Vector2));
            this.Inputs.Add("Load", new Input(this, ConnectionType.Void));

            this.Outputs.Add("OwnerChanged", new Output(this, ConnectionType.Int));
            this.Outputs.Add("Owner", new Output(this, ConnectionType.Int));
            this.Outputs.Add("Forces", new Output(this, ConnectionType.Int));
            this.Outputs.Add("Position", new Output(this, ConnectionType.Vector2));
        }
Beispiel #7
0
    private void addAtoms(int amount, GameObject atomType, List <GameObject> atomList)
    {
        for (int i = 0; i < amount; i++)
        {
            float   randY    = Random.Range(1f, 8f);
            float   randX    = Random.Range(-6f, 6f);
            float   randZ    = Random.Range(-6f, 5f);
            Vector3 startPos = new Vector3(randX, randY, randZ);
            startPos = Vector3.up;
            GameObject newAtom = (GameObject)GameObject.Instantiate(atomType, startPos, Quaternion.identity) as GameObject;
            newAtom.transform.localScale *= .232f;
            atomList.Add(newAtom);
            //GameObject newAatom = (GameObject)GameObject.Instantiate (atomType, startPos, Random.rotation) as GameObject;
        }



        for (int i = 0; i < atomList.Count; i += 2)
        {
            GameObject atom1      = atomList [i];
            GameObject atom2      = atomList [i + 1];
            FixedJoint atom1Joint = atom1.AddComponent <FixedJoint> ();
            //atom1Joint.spring = 80;
            //atom1Joint.damper = 0;
            //SphereCollider nitCol = nit1.GetComponent<SphereCollider> ();

            AtomScript atom1Script = atom1.GetComponent <AtomScript> ();
            AtomScript atom2Script = atom2.GetComponent <AtomScript> ();

            atom1Script.addBondedAtom(atom2);
            atom2Script.addBondedAtom(atom1);


            float radius = atom1.transform.localScale.x * 2f;

            Collider col = atom2.GetComponent <SphereCollider> ();


            atom2.transform.position = atom1.transform.position + new Vector3(0, radius / 2 * .5f, 0);
            atom1Joint.connectedBody = atom2.GetComponent <Rigidbody>();

            atom2.GetComponent <Rigidbody> ().AddForce(1000f, 0, 0);
            atom1.GetComponent <Rigidbody> ().AddForce(-1000f, 0, 0);

            //atom1.GetComponent<Rigidbody> ().mass = 100;

            atom2.GetComponent <Rigidbody> ().velocity = new Vector3(0, 10f, 0);
            atom1.GetComponent <Rigidbody> ().velocity = new Vector3(0, -10f, 0);
        }
    }
Beispiel #8
0
        public GetPlanets(AtomScript script)
            : base(script)
        {
            this.Inputs.Add("Player", new Input(this, ConnectionType.Int));
            this.Inputs.Add("IncludeMy", new Input(this, ConnectionType.Bool));
            this.Inputs.Add("IncludeEnemy", new Input(this, ConnectionType.Bool));
            this.Inputs.Add("IncludeNeutral", new Input(this, ConnectionType.Bool));
            this.Inputs.Add("Get", new Input(this, ConnectionType.Void));
            this.Inputs.Add("Next", new Input(this, ConnectionType.Void));
            this.Outputs.Add("For Each", new Output(this, ConnectionType.Int));

            this.Inputs["Get"].OnInput += new EventHandler<OnInput>(GetPlanets_OnInput);
            this.Inputs["Next"].OnInput += new EventHandler<OnInput>(OnNext);
        }
    public void Start()
    {
        //Finding the DynamicAtom object
        //It does not like it when you try to find a Unity object outside of a function.
        AScript = GameObject.Find("DynamicAtom").GetComponent <AtomScript>();

        DynaAtom = GameObject.Find("DynamicAtom");

        name         = "Helium";
        publicNumber = 2;
        protons      = 2;
        valance      = 2;
        neutrons     = 2;
        electrons    = 2;
        mass         = 4.003;
        trivia       = "This is helium";
    }
Beispiel #10
0
    void OnCollisionEnter(Collision col)
    {
        GameObject obj = col.collider.gameObject;


        //Checks if the tag of the collided object contains a certain string
        //.contains is used instead of == incase the collided object contains two tags
        //Such as a bullet that is also an atom
        if (obj.tag.Contains("ExplosiveBullet"))
        {
            //TODO: Move this to explosiveBulletCollide method, and others
            //TODO: Break single bonds even if double bonds exist?
            if (!hasDoubleBond())
            {
                CharacterJoint[] joints = gameObject.GetComponents <CharacterJoint> ();
                for (int i = joints.Length - 1; i >= 0; i--)
                {
                    AtomScript script = joints [i].connectedBody.GetComponent <AtomScript> ();
                    script.breakBondWith(gameObject);
                    Destroy(joints [i]);
                }
            }
            rb.AddForce(1000f * obj.transform.forward);


            //TODO: Change audio playing to method
            audioSrc.volume = .1f;
            audioSrc.clip   = bangSound;
            audioSrc.Play();
        }
        else if (obj.tag.Contains("Bullet"))
        {
            audioSrc.volume = .2f;
            audioSrc.clip   = bounceSound;
            audioSrc.Play();
        }
        else if (obj.tag.Contains("Atom"))
        {
            bondWithAtom(obj, 1);
        }
    }
Beispiel #11
0
    //Finds closest stub bond on atom1 to atom2
    //Excludes "exclude" object from search
    private GameObject closestStubBond(AtomScript atom1, AtomScript atom2, GameObject exclude)
    {
        //Temporarily set closestStubBondDistance to be a very large number, one that is likely larger than any of the stub bond distance
        float closestStubBondDistance = 10000000000;
        int   closestStubBondIndex    = 0;

        List <GameObject> atom1StubBonds = atom1.getStubBondsList();

        for (int i = 0; i < atom1.getStubBondsList().Count; i++)
        {
            if (Vector3.Distance(atom2.transform.position, atom1StubBonds[i].transform.position) < closestStubBondDistance &&
                atom1StubBonds[i].activeSelf)
            {
                if (atom1StubBonds[i] != exclude)
                {
                    closestStubBondDistance = Vector3.Distance(atom2.transform.position, atom1StubBonds[i].transform.position);
                    closestStubBondIndex    = i;
                }
            }
        }
        return(atom1StubBonds[closestStubBondIndex]);
    }
Beispiel #12
0
        void OnGameEnd()
        {
            if (playerData.ReportingEnabled)
            {
                VelesConflictReporting.GameUsageStastics gus = new VelesConflictReporting.GameUsageStastics();
                gus.Actions = GameActions;
                gus.Map = selectedMission.Map;
                gus.TimeSpent = GameTimeSpent;
                gus.Difficulty = (int)playerData.Difficulty;
                gus.DeviceID = DeviceID;
                gus.Winner = GameManager.GetLooser() == PlayerType.Player2 ? 1 : 2;
                lock (GameUsage)
                    GameUsage.Add(gus);
            }
            GameActions = 0;
            GameTimeSpent = TimeSpan.Zero;
            Manager.Enabled = true;
            MainMenuContract.Enabled = true;
            SinglePlayerContract.Enabled = false;
            GameScript.Dispose();
            GameScript = null;
            GameState = GameState.Menu;
            LevelContentManager.Unload();
            LevelContentManager.Dispose();

            textSettings.Scale = 1;
            textSettings.Origin = Vector2.Zero;
            textSettings.Width = 200;
            textSettings.Offset = new Vector2(545, 50);
            textSettings.Depth = 0.49f;
            //Select the next mission
            if (GameManager.GetLooser() == PlayerType.Player2)
            {
                Control LastControl = Manager.Menues["Mission"].Controls.Last(control => control.Tag == selectedMission);
                LastControl.Color = Color.White;
                int Index = Manager.Menues["Mission"].Controls.LastIndexOf(LastControl) + 1;
                int Offset = Manager.Menues["Mission"].Controls.IndexOf(Manager.Menues["Mission"].Controls.First(control => control.Tag is Mission));
                int Progress = EpisodeProgressCounter + selectedEpisode.Missions.IndexOf(selectedMission) + 2;
                if (Progress > playerData.GetProgress(selectedCampaing.InternalName))
                {
                    playerData.Points += selectedMission.PointsGain;
                    playerData.SetProgress(selectedCampaing.InternalName, Progress);
                }
                Mission oldMission = selectedMission;
                if (Index >= Manager.Menues["Mission"].Controls.Count)
                {
                    //Switch episodes
                    HexControl hexControl = (HexControl)Manager.Menues["Strategic"].Controls.First(c => c is HexControl);
                    foreach (int cell in selectedEpisode.Cells)
                    {
                        hexControl[cell].Color = new Color(53, 234, 28) * 0.7f;
                    }
                    hexControl[selectedEpisode.Position].Color = new Color(53, 234, 28) * 0.7f;
                    Index = selectedCampaing.Episodes.IndexOf(selectedEpisode) + 1;

                    if (Index >= selectedCampaing.Episodes.Count)
                    {
                        textManager.Text = selectedMission.Name + "\n\n\n\n\n" + selectedMission.Description;
                        textManager.Parse();

                        //Last episode
                        Manager.ClearHistory();
                        Manager.InjectMenu(Manager.Menues["Main"]);
                        if (!string.IsNullOrWhiteSpace(oldMission.Popup))
                        {
                            PopupTextManager.Text = oldMission.Popup;
                            PopupTextManager.Parse();
                            ShowEpilogueAfter = true;
                            PopupMB.Show(true);

                        }
                        else
                        {
                            (Manager.Menues["Epilogue"] as EpilogueMenu).Prepare(selectedCampaing);
                            Manager.SetMenu("Epilogue");
                        }
                    }
                    else
                    {

                        selectedEpisode = selectedCampaing.Episodes[Index];
                        hexControl[selectedEpisode.Position].Color = Color.Yellow * 0.5f;
                        EpisodeProgressCounter = 0;
                        foreach (Episode ep in selectedCampaing.Episodes)
                        {
                            if (ep != selectedEpisode)
                                EpisodeProgressCounter += ep.Missions.Count;
                            else
                                break;
                        }
                        //Trigget menu change event to rebuild the mission
                        //Manager_OnBeginMenuChange(this, new MenuChangeEventArgs() { Menu = Manager.Menues["Mission"] });
                        if (!string.IsNullOrWhiteSpace(oldMission.Popup))
                        {
                            ShowStrategicAfter = true;
                            textManager.Text = selectedMission.Name + "\n\n\n\n\n" + selectedMission.Description;
                            textManager.Parse();
                            PopupTextManager.Text = oldMission.Popup;
                            PopupTextManager.Parse();
                            PopupMB.Show(true);
                        }
                        else
                        {
                            Manager.SetMenu("Strategic");
                            Manager.ClearHistory();
                            Manager.InjectMenu(Manager.Menues["Main"]);
                            Manager.InjectMenu(Manager.Menues["Campaing"]);
                            Manager.InjectMenu(Manager.Menues["Base"]);
                        }
                    }
                }
                else
                {
                    LastControl = Manager.Menues["Mission"].Controls[Index];
                    LastControl.Color = Color.Gray;
                    LastControl.Enabled = true;
                    if (!string.IsNullOrWhiteSpace(selectedMission.Popup))
                    {
                        PopupTextManager.Text = selectedMission.Popup;
                        PopupTextManager.Parse();
                        PopupMB.Show(true);
                    }
                    selectedMission = LastControl.Tag as Mission;

                    textManager.Text = selectedMission.Name + "\n\n\n\n\n" + selectedMission.Description;
                    textManager.Parse();
                }
            }
            else
            {
                textManager.Text = selectedMission.Name + "\n\n\n\n\n" + selectedMission.Description;
                textManager.Parse();
                PopupTextManager.Text = LocalizationData.GG;
                PopupTextManager.Parse();
                PopupMB.Show(true);
            }
            playerData.Save();
            GameManager = null;
        }
Beispiel #13
0
    // Use this for initialization

    public void instantiateMolecule(MoleculeData molecule, Vector3 startingPos)
    {
        List <int>   atomList  = molecule.atom.element;
        List <int>   bondStart = molecule.bond.aid1;
        List <int>   bondEnd   = molecule.bond.aid2;
        List <int>   bondOrder = molecule.bond.order;
        List <float> xCoords   = molecule.conf.x;
        List <float> yCoords   = molecule.conf.y;
        List <float> zCoords   = molecule.conf.z;

        string moleculeName = molecule.name;

        List <GameObject> instantiatedAtoms = new List <GameObject>();

        GameObject parentMol = new GameObject();

        parentMol.transform.position = Vector3.zero;
        parentMol.name = moleculeName;


        for (int i = 0; i < atomList.Count; i++)
        {
            GameObject atomPrefab = null;
            if (atomList[i] == 8)
            {
                atomPrefab = oxygenPrefab;
            }
            else if (atomList[i] == 1)
            {
                atomPrefab = hydrogenPrefab;
            }
            else if (atomList[i] == 3)
            {
                atomPrefab = lithiumPrefab;
            }

            else if (atomList[i] == 6)
            {
                atomPrefab = carbonPrefab;
            }
            else if (atomList[i] == 7)
            {
                atomPrefab = nitrogenPrefab;
            }
            else if (atomList[i] == 9)
            {
                atomPrefab = fluorinePrefab;
            }
            else if (atomList[i] == 11)
            {
                atomPrefab = sodiumPrefab;
            }
            else if (atomList[i] == 13)
            {
                atomPrefab = aluminiumPrefab;
            }
            else if (atomList[i] == 15)
            {
                atomPrefab = phosphorusPrefab;
            }
            else if (atomList[i] == 16)
            {
                atomPrefab = sulfurPrefab;
            }
            else if (atomList[i] == 17)
            {
                atomPrefab = chlorinePrefab;
            }
            else if (atomList[i] == 26)
            {
                atomPrefab = ironPrefab;
            }
            else
            {
                Debug.Log("Trying to instantiate atom without prefab. Atomic Number: " + atomList[i]);
            }

            //Debug.Log("This is the StartingPos" + startingPos);
            //GameObject newAtom = GameObject.Instantiate (atomPrefab, new Vector3 (xCoords [i]+ startingPos.x, yCoords [i] + startingPos.y, zCoords [i] + startingPos.z) * molSize, Quaternion.identity);
            GameObject newAtom = GameObject.Instantiate(atomPrefab, new Vector3(xCoords[i] * molSize + startingPos.x, yCoords[i] * molSize + startingPos.y, zCoords[i] * molSize + startingPos.z), Quaternion.identity);

            //newAtom.transform.localScale *= molSize;
            newAtom.transform.parent = parentMol.transform;

            instantiatedAtoms.Add(newAtom);
        }
        for (int i = 0; i < bondStart.Count; i++)
        {
            //Debug.Log("Making Bond! "+i);
            int startAtomID = bondStart[i];
            int endAtomID   = bondEnd[i];

            GameObject startAtom = instantiatedAtoms[startAtomID - 1];
            GameObject endAtom   = instantiatedAtoms[endAtomID - 1];

            AtomScript startScript = startAtom.GetComponent <AtomScript>();
            AtomScript endScript   = endAtom.GetComponent <AtomScript>();

            //Ray bondLine = new Ray (startAtom.transform.position, endAtom.transform.position);
            //Vector3 bondPos = bondLine.GetPoint (Vector3.Distance (startAtom.transform.position, endAtom.transform.position));
            Vector3 bondPos = (startAtom.transform.position + endAtom.transform.position) / 2;

            Rigidbody startAtomRB = startAtom.GetComponent <Rigidbody>();
            Rigidbody endAtomRB   = endAtom.GetComponent <Rigidbody>();



            GameObject newBond;

            if (bondOrder[i] == 1)
            {
                newBond = Instantiate(bondModel, startAtom.transform.position, Quaternion.identity);
            }
            else if (bondOrder[i] == 2)
            {
                newBond = Instantiate(doubleBondModel, startAtom.transform.position, Quaternion.identity);
            }
            else
            {
                newBond = Instantiate(bondModel, startAtom.transform.position, Quaternion.identity);
            }

            Bond newBondScript = newBond.GetComponent <Bond>();
            //Debug.Log (newBond + " || " + newBondScript);
            newBondScript.formBond(startAtom, endAtom, bondOrder[i]);
            newBond.transform.SetParent(parentMol.transform);

            newBond.transform.name = "bond" + i;
        }

        for (int i = 0; i < instantiatedAtoms.Count; i++)
        {
            for (int j = 0; j < moleculeNameSounds.Count; j++)
            {
                string soundNameRepaired = moleculeNameSounds [j].name.Substring(0, moleculeNameSounds[j].name.IndexOf("Sound"));
                if (soundNameRepaired == molecule.name)
                {
                    instantiatedAtoms [i].GetComponent <AtomScript> ().setMoleculeNameSound(moleculeNameSounds [j]);
                }
            }
        }
    }
Beispiel #14
0
 public VelesGame(AtomScript Script)
     : base(Script)
 {
     this.Inputs.Add("Trigger Victory", new Input(this, ConnectionType.Void));
     this.Inputs.Add("Trigger Defeat", new Input(this, ConnectionType.Void));
 }
Beispiel #15
0
 public MapInfo(AtomScript Script)
     : base(Script)
 {
     Outputs["Name"].OnBackpropagate += MapInfo_OnBackpropagate;
     Outputs["TotalPlanets"].OnBackpropagate += TotalPlanets_OnBackpropagate;
     Script.OnLoad += Script_OnLoad;
 }
Beispiel #16
0
        public PlanetNode(AtomScript Script)
            : base(Script)
        {
            this.Inputs.Add("ID", new Input(this, ConnectionType.Int));
            this.Inputs.Add("Owner", new Input(this, ConnectionType.Int));
            this.Inputs.Add("Forces", new Input(this, ConnectionType.Int));
            this.Inputs.Add("Position", new Input(this, ConnectionType.Vector2));
            this.Inputs.Add("Load", new Input(this, ConnectionType.Void));

            this.Outputs.Add("OwnerChanged", new Output(this, ConnectionType.Int));
            this.Outputs.Add("Owner", new Output(this, ConnectionType.Int));
            this.Outputs.Add("Forces", new Output(this, ConnectionType.Int));
            this.Outputs.Add("Position", new Output(this, ConnectionType.Vector2));

            this.Inputs["Load"].OnInput += OnLoad;
            this.Inputs["Forces"].OnInput += OnSetForces;
            this.Inputs["Owner"].OnInput += OnSetOwner;
            this.Inputs["Position"].OnInput += OnSetPosition;

            this.Outputs["Owner"].OnBackpropagate += OwnerBack;
            this.Outputs["Forces"].OnBackpropagate += ForcesBack;
            this.Outputs["Position"].OnBackpropagate += PositionBack;
            IUpdateService service = Globals.Engine.GetService(typeof(IUpdateService)) as IUpdateService;
            service.Subscribe(OnUpdateEvent);
        }
Beispiel #17
0
    public void bondWithAtom(GameObject obj, int bondOrder)
    {
        AtomScript collidedAtomScript = obj.GetComponent <AtomScript>();

        if (nBondConnections < allowedBonds && collidedAtomScript.nBondConnections < collidedAtomScript.allowedBonds)
        {
            //Debug.Log(obj.tag.Contains("Bullet"));
            //Debug.Log(obj.tag);

            if (obj.tag.Contains("Bullet"))
            {
                Slug slugScript = obj.GetComponent <Slug>();
                slugScript.resetToAtom();
            }
            else if (tag.Contains("Bullet"))
            {
                Slug slugScript = GetComponent <Slug>();
                slugScript.resetToAtom();
            }


            if (bondedAtoms.Contains(obj) == false)        //Ignore collision with atom I am already bonded to



            {
                GameObject startAtom       = gameObject;
                AtomScript startAtomScript = this;
                GameObject endAtom         = obj;
                AtomScript endAtomScript   = collidedAtomScript;

                //Has no bonds
                bool startAtomIsSingletonAtom = startAtomScript.getBondedAtoms().Count == 0;
                bool endAtomIsSingletonAtom   = endAtomScript.getBondedAtoms().Count == 0;



                Vector3    startAtomOldPosition = startAtom.transform.position;
                Quaternion startAtomOldRotation = startAtom.transform.rotation;

                Vector3    endAtomOldPosition = endAtom.transform.position;
                Quaternion endAtomOldRotation = endAtom.transform.rotation;


                GameObject endAtomStub   = closestStubBond(endAtomScript, startAtomScript); //endAtomScript.getStubBondsList()[closestStubBondOnEndAtomIndex];
                GameObject startAtomStub = closestStubBond(startAtomScript, endAtomScript);



                Vector3 endAtomStubDirection = (endAtomStub.transform.position - endAtom.transform.position).normalized;

                Vector3 startAtomStubDirection = (startAtomStub.transform.position - startAtom.transform.position).normalized;

                /*
                 * //Checks to see if a double bond should be formed
                 * int possibleBondsOfThisAtom = allowedBonds - nBondConnections;
                 * int possibleBondsOfCollidedAtom = collidedAtomScript.allowedBonds - collidedAtomScript.nBondConnections;
                 *
                 * //selects the lowest number of open bonds
                 * int newBondOrder = Mathf.Min(possibleBondsOfThisAtom, possibleBondsOfCollidedAtom);
                 * //If the lowest number of open bonds is greater than 2, then it will default to 2, since triple bonds haven't been added yet
                 * if (newBondOrder > 2)
                 *  newBondOrder = 2;*/

                //bondPrefab is the placeholder for either a single or double bond
                GameObject bondPrefab;

                int newBondOrder = bondOrder;
                if (newBondOrder == 1)
                {
                    bondPrefab = bondGameObject;
                }
                else if (newBondOrder == 2)
                {
                    bondPrefab = doubleBondGameObject;
                    GameObject endAtomSecondClosestStub   = closestStubBond(endAtomScript, startAtomScript, endAtomStub);
                    GameObject startAtomSecondClosestStub = closestStubBond(startAtomScript, endAtomScript, startAtomStub);

                    endAtomStubDirection = ((endAtomStub.transform.position + endAtomSecondClosestStub.transform.position) / 2 - endAtom.transform.position).normalized;

                    startAtomStubDirection = ((startAtomStub.transform.position + startAtomSecondClosestStub.transform.position) / 2 - startAtom.transform.position).normalized;
                }
                else
                {
                    bondPrefab = bondGameObject;
                }


                if (startAtomIsSingletonAtom)
                {
                    Vector3 directionFromStartToEndAtom = endAtom.transform.position - startAtom.transform.position;
                    //Vector3 oldStartAtomStubDirection = (startAtomStub.transform.position - startAtom.transform.position).normalized;

                    startAtom.transform.rotation = Quaternion.FromToRotation(startAtomStubDirection, directionFromStartToEndAtom) * startAtomOldRotation;
                }

                if (endAtomIsSingletonAtom)
                {
                    Vector3 directionFromEndToStartAtom = startAtom.transform.position - endAtom.transform.position;
                    // Vector3 oldEndAtomStubDirection = (endAtomStub.transform.position - endAtom.transform.position).normalized;

                    endAtom.transform.rotation = Quaternion.FromToRotation(endAtomStubDirection, directionFromEndToStartAtom) * endAtomOldRotation;
                }



                //reset the bond directions

                if (newBondOrder == 2)
                {
                    GameObject endAtomSecondClosestStub   = closestStubBond(endAtomScript, startAtomScript, endAtomStub);
                    GameObject startAtomSecondClosestStub = closestStubBond(startAtomScript, endAtomScript, startAtomStub);
                    endAtomStubDirection = ((endAtomStub.transform.position + endAtomSecondClosestStub.transform.position) / 2 - endAtom.transform.position).normalized;

                    startAtomStubDirection = ((startAtomStub.transform.position + startAtomSecondClosestStub.transform.position) / 2 - startAtom.transform.position).normalized;
                }
                else if (newBondOrder == 1)
                {
                    endAtomStubDirection   = (endAtomStub.transform.position - endAtom.transform.position).normalized;
                    startAtomStubDirection = (startAtomStub.transform.position - startAtom.transform.position).normalized;
                }



                //Set temporary position of atoms. This will be their real position once the joints drag them into position
                float bondDistanceModifier = (endAtom.transform.localScale.x + startAtom.transform.localScale.x) * (.65f);
                startAtom.transform.position = endAtom.transform.position + bondDistanceModifier * endAtomStubDirection;
                startAtom.transform.rotation = Quaternion.FromToRotation(startAtomStubDirection, -endAtomStubDirection) * startAtomOldRotation;



                //The new bond is instantiated, and then formBond is called on the two connected atoms (along with bondOrder, which says whether the bond is a single, double, or triple bond)
                GameObject newBond = Instantiate(bondPrefab, gameObject.transform.position, Quaternion.identity);
                newBond.GetComponent <Bond> ().formBond(startAtom, endAtom, newBondOrder);

                startAtom.transform.position = startAtomOldPosition;

                startAtom.transform.rotation = startAtomOldRotation;
            }
        }
    }
Beispiel #18
0
    public GameObject instantiateMiniatureRigidMolecule(MoleculeData molecule, Vector3 startingPos)
    {
        List <int>   atomList  = molecule.atom.element;
        List <int>   bondStart = molecule.bond.aid1;
        List <int>   bondEnd   = molecule.bond.aid2;
        List <int>   bondOrder = molecule.bond.order;
        List <float> xCoords   = molecule.conf.x;
        List <float> yCoords   = molecule.conf.y;
        List <float> zCoords   = molecule.conf.z;

        float sizeDecreaseDelta = .1f;

        string moleculeName = molecule.name;

        List <GameObject> instantiatedAtoms = new List <GameObject>();

        GameObject parentMol = new GameObject();

        parentMol.transform.position = Vector3.zero;
        parentMol.name = moleculeName;


        for (int i = 0; i < atomList.Count; i++)
        {
            GameObject atomPrefab = null;
            if (atomList[i] == 8)
            {
                atomPrefab = oxygenPrefab;
            }
            else if (atomList[i] == 1)
            {
                atomPrefab = hydrogenPrefab;
            }
            else if (atomList[i] == 3)
            {
                atomPrefab = lithiumPrefab;
            }

            else if (atomList[i] == 6)
            {
                atomPrefab = carbonPrefab;
            }
            else if (atomList[i] == 7)
            {
                atomPrefab = nitrogenPrefab;
            }
            else if (atomList[i] == 9)
            {
                atomPrefab = fluorinePrefab;
            }
            else if (atomList[i] == 11)
            {
                atomPrefab = sodiumPrefab;
            }
            else if (atomList[i] == 13)
            {
                atomPrefab = aluminiumPrefab;
            }
            else if (atomList[i] == 15)
            {
                atomPrefab = phosphorusPrefab;
            }
            else if (atomList[i] == 16)
            {
                atomPrefab = sulfurPrefab;
            }
            else if (atomList[i] == 17)
            {
                atomPrefab = chlorinePrefab;
            }
            else if (atomList[i] == 26)
            {
                atomPrefab = ironPrefab;
            }
            else
            {
                Debug.Log("Trying to instantiate atom without prefab. Atomic Number: " + atomList[i]);
            }

            GameObject newAtom = GameObject.Instantiate(atomPrefab, new Vector3(xCoords[i] * molSize + startingPos.x, yCoords[i] * molSize + startingPos.y, zCoords[i] * molSize + startingPos.z), Quaternion.identity);
            Destroy(newAtom.GetComponent <Rigidbody>());

            Destroy(newAtom.GetComponent <AudioSource>());


            //Used to delete all of the children (i.e stubs) off of the atom, since this atom is irregular (as it's being used in the miniature molecule)
            foreach (Transform child in newAtom.transform)
            {
                Destroy(child.gameObject);
            }


            newAtom.transform.parent = parentMol.transform;



            newAtom.tag = "Untagged";
            Destroy(newAtom.GetComponent <AtomScript>());
            Destroy(newAtom.GetComponentInChildren <Collider>());
            instantiatedAtoms.Add(newAtom);
        }
        for (int i = 0; i < bondStart.Count; i++)
        {
            //Debug.Log("Making Bond! "+i);
            int startAtomID = bondStart[i];
            int endAtomID   = bondEnd[i];

            GameObject startAtom = instantiatedAtoms[startAtomID - 1];
            GameObject endAtom   = instantiatedAtoms[endAtomID - 1];

            AtomScript startScript = startAtom.GetComponent <AtomScript>();
            AtomScript endScript   = endAtom.GetComponent <AtomScript>();

            //Ray bondLine = new Ray (startAtom.transform.position, endAtom.transform.position);
            //Vector3 bondPos = bondLine.GetPoint (Vector3.Distance (startAtom.transform.position, endAtom.transform.position));
            Vector3 bondPos = (startAtom.transform.position + endAtom.transform.position) / 2;

            Rigidbody startAtomRB = startAtom.GetComponent <Rigidbody>();
            Rigidbody endAtomRB   = endAtom.GetComponent <Rigidbody>();



            GameObject newBond;

            if (bondOrder[i] == 1)
            {
                newBond = Instantiate(bondModel, startAtom.transform.position, Quaternion.identity);
            }
            else if (bondOrder[i] == 2)
            {
                newBond = Instantiate(doubleBondModel, startAtom.transform.position, Quaternion.identity);
            }
            else
            {
                newBond = Instantiate(bondModel, startAtom.transform.position, Quaternion.identity);
            }


            Destroy(newBond.GetComponentInChildren <Collider>());
            Bond newBondScript = newBond.GetComponent <Bond>();
            //Debug.Log (newBond + " || " + newBondScript);
            //  newBondScript.formBond(startAtom, endAtom, bondOrder[i]);
            newBondScript.setConnectedAtoms(startAtom, endAtom);
            newBond.transform.SetParent(parentMol.transform);

            newBond.transform.name = "bond" + i;
        }
        parentMol.transform.localScale = new Vector3(sizeDecreaseDelta, sizeDecreaseDelta, sizeDecreaseDelta);
        parentMol.AddComponent(typeof(CapsuleCollider));
        parentMol.tag = "Tractorable";
        parentMol.AddComponent(typeof(Rigidbody));
        //parentMol.GetComponent<Rigidbody>().useGravity = false;

        parentMol.transform.position = startingPos;
        return(parentMol);
    }
Beispiel #19
0
        internal void EditorStartGame()
        {
            InternalPause = false;
            Manager.Enabled = false;
            MainMenuContract.Enabled = false;
            SinglePlayerContract.Enabled = true;
            RCS.PreCache<Texture2D>("selection_planet_ingame");
            GameScript = new AtomScript(false, new Assembly[] { Assembly.GetExecutingAssembly() });
            GameScript.Pause = false;

            AI = new AIManager();
            FleetTexture1 = LevelContentManager.Load<Texture2D>("Graphics/Fleets/3");
            FleetTexture2 = LevelContentManager.Load<Texture2D>("Graphics/Fleets/5");
            Random rnd = new Random();
            int ParalaxFolder = rnd.Next(1, 6);
            ParalaxLayer1 = LevelContentManager.Load<Texture2D>(string.Format("Graphics/Backgrounds/{0}/1", ParalaxFolder));
            ParalaxLayer2 = LevelContentManager.Load<Texture2D>(string.Format("Graphics/Backgrounds/{0}/2", ParalaxFolder));
            ParalaxLayer3 = LevelContentManager.Load<Texture2D>(string.Format("Graphics/Backgrounds/{0}/3", ParalaxFolder));
            GameState = GameState.Singleplayer;
        }
Beispiel #20
0
        void LoadMission(Mission mission)
        {
            GameActions = 0;
            GameTimeSpent = TimeSpan.Zero;
            spriteBatch.Begin();
            spriteBatch.Draw(Splash, Vector2.Zero, Color.White);
            spriteBatch.End();
            GraphicsDevice.Present();
            RCS.Release(TimeSpan.Zero);
            LevelContentManager = new ContentManager(this, "Content");
            GameManager = new GameManager();
            GameScript = new AtomScript(false, new Assembly[] { Assembly.GetExecutingAssembly() });
            GameScript.Pause = false;
            string map = "";
            Random rnd = new Random();
            //Properly resolve the mission address
            if (mission.Map.StartsWith("XAP\\"))
            {
                //internal content
                map = mission.Map.Remove(0, 4);
            }

            int LargeNotPopulated = 3;
            int LargePopulated = 4;

            int MediumNotPopulated = 2;
            int MediumPopulated = 3;

            int SmallNotPopulated = 3;
            int SmallPopulated = 3;

            List<Planet> mapPlanets = new List<Planet>();
            XmlReader xmlReader = XmlReader.Create(map);
            xmlReader.ReadStartElement();

            xmlReader.Read();
            xmlReader.MoveToElement();
            xmlReader.ReadStartElement("Width");
            Width = xmlReader.ReadContentAsInt();

            xmlReader.Read();
            xmlReader.MoveToElement();
            xmlReader.ReadStartElement("Height");
            Height = xmlReader.ReadContentAsInt();

            if (Width > 800 && Height > 480)
            {
                SetupCameraBig();
            }
            else
            {
                SetupCameraSmall();
            }

            xmlReader.Read();
            xmlReader.MoveToElement();
            xmlReader.ReadStartElement("Format");
            int Format = xmlReader.ReadContentAsInt();

            xmlReader.Read();
            xmlReader.MoveToElement();
            xmlReader.ReadStartElement("HasScript");
            bool HasScript = xmlReader.ReadContentAsBoolean();
            if (HasScript)
            {
                xmlReader.ReadToFollowing("Script");
                GameScript.Load(xmlReader);
            }
            #region Load Map
            while (xmlReader.Read())
            {
                /*Read planet header*/
                if (xmlReader.LocalName == "Planet" && xmlReader.IsStartElement())
                {
                    /*Read the ID element*/
                    xmlReader.Read();
                    xmlReader.MoveToElement();
                    xmlReader.ReadStartElement("ID");
                    int ID = xmlReader.ReadContentAsInt();

                    /*Read the owner element*/
                    xmlReader.Read();
                    xmlReader.MoveToElement();
                    xmlReader.ReadStartElement("Owner");
                    string owner = xmlReader.ReadContentAsString();

                    /*Read the forces element*/
                    xmlReader.Read();
                    xmlReader.MoveToElement();
                    xmlReader.ReadStartElement("Forces");
                    int forces = xmlReader.ReadContentAsInt();

                    /*Read the growth element*/
                    xmlReader.Read();
                    xmlReader.MoveToElement();
                    xmlReader.ReadStartElement("Growth");
                    int growth = xmlReader.ReadContentAsInt();

                    /*Read the growth cooldown element*/
                    xmlReader.Read();
                    xmlReader.MoveToElement();
                    xmlReader.ReadStartElement("GrowthCooldown");
                    int growthcd = xmlReader.ReadContentAsInt();

                    /*Read the size element*/
                    xmlReader.Read();
                    xmlReader.MoveToElement();
                    xmlReader.ReadStartElement("Size");
                    float size = xmlReader.ReadContentAsFloat();

                    /*Read the people element*/
                    xmlReader.Read();
                    xmlReader.MoveToElement();
                    xmlReader.ReadStartElement("HasPeople");
                    bool hasppl = xmlReader.ReadContentAsBoolean();

                    /*Read the Position element*/
                    xmlReader.Read();
                    xmlReader.MoveToElement();
                    xmlReader.ReadStartElement("Position");
                    Microsoft.Xna.Framework.Vector2 Position = new Microsoft.Xna.Framework.Vector2();

                    /*Read the X element*/
                    xmlReader.Read();
                    xmlReader.MoveToElement();
                    xmlReader.ReadStartElement("X");
                    Position.X = xmlReader.ReadContentAsInt();

                    /*Read the Y element*/
                    xmlReader.Read();
                    xmlReader.MoveToElement();
                    xmlReader.ReadStartElement("Y");
                    Position.Y = xmlReader.ReadContentAsInt();

                    Planet p = new Planet();
                    p.Id = ID;
                    p.Position = Position;
                    p.Growth = growth;
                    p.GrowthCounter = growthcd;
                    p.GrowthReset = growthcd;
                    p.Owner = (PlayerType)Enum.Parse(typeof(PlayerType), owner, false);
                    p.Forces = forces;
                    p.PlanetSize = size;
                    p.HasPeople = hasppl;

                    PlanetSize pz = PlanetSize.Large;
                    //Determine the load location
                    string TextureLocation = "Graphics/Planets/";
                    if (p.PlanetSize >= 0.6)
                    {
                        pz = PlanetSize.Large;
                    }
                    else
                    {
                        if(rnd.NextDouble()<0.35)
                            pz=PlanetSize.Small;
                        else
                            pz=PlanetSize.Medium;
                    }

                    TextureLocation += pz.ToString() + "/";
                    switch (pz)
                    {
                        case PlanetSize.Large:
                            if (p.HasPeople)
                            {
                                int Number = rnd.Next(1, (LargePopulated + 1));
                                TextureLocation += "Populated/" + Number.ToString();
                            }
                            else
                            {
                                int Number = rnd.Next(1, (LargeNotPopulated + 1));
                                TextureLocation += "NotPopulated/" + Number.ToString();
                            }
                            break;
                        case PlanetSize.Medium:
                            if (p.HasPeople)
                            {
                                int Number = rnd.Next(1, (MediumPopulated + 1));
                                TextureLocation += "Populated/" + Number.ToString();
                            }
                            else
                            {
                                int Number = rnd.Next(1, (MediumNotPopulated + 1));
                                TextureLocation += "NotPopulated/" + Number.ToString();
                            }
                            break;
                        case PlanetSize.Small:
                            if (p.HasPeople)
                            {
                                int Number = rnd.Next(1, (SmallPopulated + 1));
                                TextureLocation += "Populated/" + Number.ToString();
                            }
                            else
                            {
                                int Number = rnd.Next(1, (SmallNotPopulated + 1));
                                TextureLocation += "NotPopulated/" + Number.ToString();
                            }
                            break;
                    }

                    p.Texture = LevelContentManager.Load<Texture2D>(TextureLocation);
                    mapPlanets.Add(p);
                }

            }
            #endregion
            FleetTexture1 = LevelContentManager.Load<Texture2D>("Graphics/Fleets/3");
            FleetTexture2 = LevelContentManager.Load<Texture2D>("Graphics/Fleets/5");
            int ParalaxFolder = rnd.Next(1, 6);
            ParalaxLayer1 = LevelContentManager.Load<Texture2D>(string.Format("Graphics/Backgrounds/{0}/1", ParalaxFolder));
            ParalaxLayer2 = LevelContentManager.Load<Texture2D>(string.Format("Graphics/Backgrounds/{0}/2", ParalaxFolder));
            ParalaxLayer3 = LevelContentManager.Load<Texture2D>(string.Format("Graphics/Backgrounds/{0}/3", ParalaxFolder));
            GameManager.State.Planets.AddRange(mapPlanets);
            GameScript.LoadScript();
            GameScript.Pause = false;
            xmlReader.Dispose();
        }
Beispiel #21
0
 void Exit_OnClick(object sender, EventArgs e)
 {
     Manager.Enabled = true;
     MainMenuContract.Enabled = true;
     SinglePlayerContract.Enabled = false;
     GameScript.Dispose();
     GameScript = null;
     GameState = GameState.Menu;
     LevelContentManager.Unload();
     LevelContentManager.Dispose();
     PauseManager.Enabled = false;
     //textSettings.Scale = 1;
     //textSettings.Origin = Vector2.Zero;
     //textSettings.Width = 200;
     //textSettings.Offset = new Vector2(545, 50);
     //textSettings.Depth = 0.49f;
     textManager.Settings.Width = 200;
     textManager.Settings.Offset = new Vector2(545, 50);
     textManager.Text = selectedMission.Name + "\n\n\n\n\n" + selectedMission.Description;
     textManager.Parse();
     GameManager = null;
     GameActions = 0;
     GameTimeSpent = TimeSpan.Zero;
 }
Beispiel #22
0
 //Overloads closestStubBond method without exclude parameter
 private GameObject closestStubBond(AtomScript atom1, AtomScript atom2)
 {
     return(closestStubBond(atom1, atom2, null));
 }
Beispiel #23
0
 public VelesAchievements(AtomScript Script)
     : base(Script)
 {
     this.Inputs.Add("Achievement", new Input(this, ConnectionType.String));
     this.Inputs.Add("Trigger", new Input(this, ConnectionType.Void));
 }
    public void Update()
    {
        CurrentAtom = GameObject.Find("CAtom");                 // Takes the atom that is currently being created and pulls it from Current Atom.
        DynamicAtom = GameObject.Find("DynamicAtom");           // Dynamic Atom is a object that is created inside of each element's script.
        AScript     = DynamicAtom.GetComponent <AtomScript>();  // Pulls the variables from the AtomScript class.
        Elum        = AScript.name;                             // Takes the name variable from the AScript object and assings it.
        temp        = DynamicAtom;                              // Creates new object called temp.
        if (Input.GetMouseButtonDown(0))
        {
            //temp = new GameObject("DynamicAtom");
            //temp.SetActive(true);
            temp = Instantiate(DynamicAtom, Input.mousePosition, Quaternion.identity);
            temp.transform.position = CurrentAtom.transform.position; // + Vector3.right * 200;
        }
        if (Input.GetMouseButton(0))
        {
            temp.transform.position = Input.mousePosition;
        }
        if (Input.GetMouseButtonUp(0) && CurrentAtom)
        {
            temp = null;
        }

        if (AScript.name == "Helium")
        {
            for (int p = 1; p < DynamicAtom.GetComponent <AtomScript>().electrons + 1; p++)
            {
                //  Counts the amount of Electrons and determines how many energy levels/rings are needed
                if (eCount + 1 <= 2 && eCount + 1 <= DynamicAtom.GetComponent <AtomScript>().electrons)//(eCount < 2)
                {
                    energyLevel = energyLevel + 1;
                    eCount++;
                }
                else if (eCount + 1 <= 10 && eCount + 1 <= DynamicAtom.GetComponent <AtomScript>().electrons)
                {
                    baseElectron = 2;
                    energyLevel  = energyLevel + 1;
                    eCount++;
                }
                else if (eCount + 1 <= 18 && eCount + 1 <= DynamicAtom.GetComponent <AtomScript>().electrons)
                {
                    baseElectron = 10;
                    energyLevel  = energyLevel + 1;
                    eCount++;
                }
            }
            //  Draws the rings around CAtom
            for (int rings = 1; rings < energyLevel + 1; rings++)
            {
                //USE UNITY TO DRAW A CIRCLE/ RING AROUND CAtom and increase the distance by distBetweenEnergyLevels
                //TODO.
            }

            //      Determine how many electrons are left unused to reach the shell and display that number
            remainElectron = eCount - baseElectron;

            //      Using the UI, display the amount of remaining electrons and place it on that final ring
            //electronDisplay.text = remainElectron.ToString(); // MIGHT NEED TO CONVERT THE INT remainElectron to a String for the UI to accept it. Unsure how to do so?
            MR.color = Color.red;
        }

        else if (AScript.name == "Lithium")
        {
            for (int p = 1; p < DynamicAtom.GetComponent <AtomScript>().electrons + 1; p++)
            {
                //  Counts the amount of Electrons and determines how many energy levels/rings are needed
                if (eCount + 1 <= 2 && eCount + 1 <= DynamicAtom.GetComponent <AtomScript>().electrons)//(eCount < 2)
                {
                    energyLevel = energyLevel + 1;
                    eCount++;
                }
                else if (eCount + 1 <= 10 && eCount + 1 <= DynamicAtom.GetComponent <AtomScript>().electrons)
                {
                    baseElectron = 2;
                    energyLevel  = energyLevel + 1;
                    eCount++;
                }
                else if (eCount + 1 <= 18 && eCount + 1 <= DynamicAtom.GetComponent <AtomScript>().electrons)
                {
                    baseElectron = 10;
                    energyLevel  = energyLevel + 1;
                    eCount++;
                }
            }

            //  Draws the rings around CAtom
            for (int rings = 1; rings < energyLevel + 1; rings++)
            {
                //USE UNITY TO DRAW A CIRCLE/ RING AROUND CAtom and increase the distance by distBetweenEnergyLevels
                //TODO.
            }

            //      Determine how many electrons are left unused to reach the shell and display that number
            remainElectron = eCount - baseElectron;

            //      Using the UI, display the amount of remaining electrons and place it on that final ring
            //electronDisplay.text = remainElectron.ToString(); // MIGHT NEED TO CONVERT THE INT remainElectron to a String for the UI to accept it. Unsure how to do so?
            MR.color = Color.blue;
        }



        // ELEMENT BREAK POINT:
        else if (AScript.name == "Be")
        {
            for (int p = 1; p < AScript.electrons + 1; p++)
            {
                //  Counts the amount of Electrons and determines how many energy levels/rings are needed
                if (eCount < 2)//(eCount < 2)
                {
                    energyLevel  = energyLevel + 1;
                    baseElectron = 2;
                }
                else if (eCount < 10)
                {
                    energyLevel  = energyLevel + 1;
                    baseElectron = 10;
                }
                else if (eCount < 18)
                {
                    energyLevel  = energyLevel + 1;
                    baseElectron = 18;
                }
                else
                {
                    energyLevel = energyLevel + 1;
                }
                eCount++;

                //  Draws the rings around CAtom
                for (int rings = 1; rings < energyLevel + 1; rings++)
                {
                    // TODO: USE UNITY TO DRAW A CIRCLE/ RING AROUND CAtom and increase the distance by distBetweenEnergyLevels
                }

                //      Determine how many electrons are left unused to reach the shell and display that number
                remainElectron = eCount - baseElectron;

                //      Using the UI, display the amount of remaining electrons and place it on that final ring
                //electronDisplay.text = remainElectron.ToString(); // MIGHT NEED TO CONVERT THE INT remainElectron to a String for the UI to accept it. Unsure how to do so?
            }
            MR.color = Color.green;
        }
    }