Esempio n. 1
0
    public static void ChangeTM(ObjectsOnDNA toChange, string newSub, float convertPos)
    {
        GameObject[] transcriptionalMachineries = GameObject.FindGameObjectsWithTag("TranscriptionalMachinery");

        foreach (GameObject tm in transcriptionalMachineries)
        {
            if (tm.transform.position.x == convertPos)
            {
                if (newSub == "'Crick-Init0'" || newSub == "'Crick-Init1'" || newSub == "'Crick-Init2'" || newSub == "'Crick-Init3'" || newSub == "'Crick-Init4'")
                {
                    tm.gameObject.renderer.material.color = new Color(0.957f, 0.643f, 0.376f);
                }
                else if (newSub == "'Watson-Init0'" || newSub == "'Watson-Init1'" || newSub == "'Watson-Init2'" || newSub == "'Watson-Init3'" || newSub == "'Watson-Init4'")
                {
                    tm.gameObject.renderer.material.color = new Color(0.957f, 0.643f, 0.376f);
                }
                else if (newSub == "'Crick'" || newSub == "'Watson'")
                {
                    tm.gameObject.renderer.material.color = new Color(0.874f, 0.412f, 0.118f);
                }
                else if (newSub == "'Crick-Transcribed'" || newSub == "'Watson-Transcribed'")
                {
                    tm.gameObject.renderer.material.color = new Color(0.800f, 0.500f, 0.118f);
                }
                else if (newSub == "'Crick-Paused'" || newSub == "'Watson-Paused'")
                {
                    tm.gameObject.renderer.material.color = new Color(0.874f, 0.412f, 0.118f);
                }
                else
                {
                    tm.gameObject.renderer.material.color = new Color(0.855f, 0.647f, 0.125f);
                }
            }
        }
    }
Esempio n. 2
0
    public static void ChangeSubtype(ObjectsOnDNA toChange, string newSub)
    {
        //toDelete.StartPosition has to be converted to nucleotide location
        float convertPos   = 0;
        float tempStartPos = 0;

        if (toChange.MainType == "'Nucleosome'")
        {
            tempStartPos = toChange.StartPosition + (toChange.Length / 4);
            convertPos   = (tempStartPos / 3.5f) - .6f;

            NucleosomeClass.ChangeNuc(toChange, newSub, convertPos);
        }
        else if (toChange.MainType == "'Transcription_Factor'")
        {
            tempStartPos = toChange.StartPosition + (toChange.Length / 3.5f);
            convertPos   = (tempStartPos / 3.5f) - .6f;
        }
        else if (toChange.MainType == "'Transcriptional_Machinery'")
        {
            tempStartPos = toChange.StartPosition + (toChange.Length / 3.5f);
            convertPos   = (tempStartPos / 3.5f) - .6f;

            TranscriptionalMachineryClass.ChangeTM(toChange, newSub, convertPos);
        }
    }
Esempio n. 3
0
    public static void MakeWait(ObjectsOnDNA toWait)
    {
        GameObject[] nucleosomes                = GameObject.FindGameObjectsWithTag("Nucleosome");
        GameObject[] transcriptionFactors       = GameObject.FindGameObjectsWithTag("TranscriptionFactor");
        GameObject[] transcriptionalMachineries = GameObject.FindGameObjectsWithTag("TranscriptionalMachinery");

        // StartPosition has to be converted to nucleotide location
        float convertPos   = 0;
        float tempStartPos = 0;

        // SET LOCATIONS
        if (toWait.MainType == "'Nucleosome'")
        {
            // Locate Object to Move
            tempStartPos = toWait.StartPosition + (toWait.Length / 4);
            convertPos   = (tempStartPos / 3.5f) - .6f;
        }
        else if (toWait.MainType == "'Transcription_Factor'")
        {
            tempStartPos = toWait.StartPosition + (toWait.Length / 3.5f);
            convertPos   = (tempStartPos / 3.5f) - .6f;
        }
        else if (toWait.MainType == "'Transcriptional_Machinery'")
        {
            tempStartPos = toWait.StartPosition + (toWait.Length / 3.5f);
            convertPos   = (tempStartPos / 3.5f) - .6f;
        }


        // HANDLE MOVEMENT
        foreach (GameObject nuc in nucleosomes)
        {
            if (nuc.transform.position.x == convertPos)
            {
                iTween.MoveTo(nuc, new Vector3(convertPos, 12.5f, 0), 2f);
//				iTween.MoveTo (nuc, new Vector3 (convertPos, 20f, 0), 2f);
            }
        }

        foreach (GameObject tf in transcriptionFactors)
        {
            if (tf.transform.position.x == convertPos)
            {
                iTween.MoveTo(tf, new Vector3(convertPos, 12.5f, 0), 2f);
            }
        }

        foreach (GameObject tm in transcriptionalMachineries)
        {
            if (tm.transform.position.x == convertPos)
            {
                iTween.MoveTo(tm, new Vector3(convertPos, 15f, 0), 2f);
                Debug.Log(convertPos);
//				Debug.Log (finalMovePoint);
            }
        }
    }
Esempio n. 4
0
    // TEMPORARY HANDLING OF ANIMATION
    public IEnumerator TempAni(List <InstructionObject> toAnimate)
    {
        foreach (InstructionObject joe in toAnimate)
        {
            if (joe.instruction == "NucleosomeClass.CreateNucleosome")
            {
                NucleosomeClass.CreateNucleosome(joe.TranscriptionSimObject);
            }
            else if (joe.instruction == "TranscriptionFactorClass.CreateTranscriptionFactor")
            {
                TranscriptionFactorClass.CreateTranscriptionFactor(joe.TranscriptionSimObject);
            }
            else if (joe.instruction == "TranscriptionalMachineryClass.CreateTranscriptionalMachinery")
            {
                TranscriptionalMachineryClass.CreateTranscriptionalMachinery(joe.TranscriptionSimObject);
            }

            if (joe.instruction == "ObjectsOnDNA.DeleteObject")
            {
                ObjectsOnDNA.DeleteObject(joe.TranscriptionSimObject);
            }

            if ((joe.instruction.Contains("0") || joe.instruction.Contains("1") || joe.instruction.Contains("2") ||
                 joe.instruction.Contains("3") || joe.instruction.Contains("4") || joe.instruction.Contains("5") ||
                 joe.instruction.Contains("6") || joe.instruction.Contains("7") || joe.instruction.Contains("8") ||
                 joe.instruction.Contains("9")) && !joe.instruction.Contains("Init"))
            {
                var xPos = Convert.ToSingle(joe.instruction);

                ObjectsOnDNA.MoveObject(joe.TranscriptionSimObject, xPos);
            }


            if (joe.instruction == "'Binding'" || joe.instruction == "'Unbinding'" || joe.instruction == "'Stable'")
            {
                ObjectsOnDNA.ChangeSubtype(joe.TranscriptionSimObject, joe.instruction);
            }
            else if (joe.instruction.Contains("Crick") || joe.instruction.Contains("Watson"))
            {
                ObjectsOnDNA.ChangeSubtype(joe.TranscriptionSimObject, joe.instruction);
            }

            if (joe.instruction == "WAIT")
            {
                ObjectsOnDNA.MakeWait(joe.TranscriptionSimObject);
            }
        }

        yield return(0);
    }
Esempio n. 5
0
    public static GameObject CreateTranscriptionalMachinery(ObjectsOnDNA TM)
    {
        GameObject NewTranscriptionalMachinery;

        NewTranscriptionalMachinery = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
        NewTranscriptionalMachinery.transform.localScale     = new Vector3(TM.Length / 3.5f, TM.Length / 5, TM.Length / 5);                     // Scale extends on both sides, so is a bad ultimate choice
        NewTranscriptionalMachinery.renderer.material.shader = Shader.Find("Specular");

        TM.StartPosition += TM.Length / 3.5f;

//		NewTranscriptionalMachinery.transform.position = new Vector3 ((TM.StartPosition / 3.5f) - 0.6f, 0.3f, 0);

        NewTranscriptionalMachinery.transform.position = new Vector3(10, 25, 0);
        iTween.MoveTo(NewTranscriptionalMachinery, new Vector3((TM.StartPosition / 3.5f) - 0.6f, 0.3f, 0), 1.5f);



        NewTranscriptionalMachinery.name = "TranscriptionalMachinery";
        NewTranscriptionalMachinery.tag  = "TranscriptionalMachinery";


        // Transcription Factor Color
        if (TM.Subtype == "'Crick-Init0'" || TM.Subtype == "'Crick-Init1'" || TM.Subtype == "'Crick-Init2'" || TM.Subtype == "'Crick-Init3'" || TM.Subtype == "'Crick-Init4'")
        {
            NewTranscriptionalMachinery.gameObject.renderer.material.color = new Color(0.957f, 0.643f, 0.376f);
        }
        else if (TM.Subtype == "'Watson-Init0'" || TM.Subtype == "'Watson-Init1'" || TM.Subtype == "'Watson-Init2'" || TM.Subtype == "'Watson-Init3'" || TM.Subtype == "'Watson-Init4'")
        {
            NewTranscriptionalMachinery.gameObject.renderer.material.color = new Color(0.957f, 0.643f, 0.376f);
        }
        else if (TM.Subtype == "'Crick'" || TM.Subtype == "'Watson'")
        {
            NewTranscriptionalMachinery.gameObject.renderer.material.color = new Color(0.874f, 0.412f, 0.118f);
        }
        else if (TM.Subtype == "'Crick-Transcribed'" || TM.Subtype == "'Watson-Transcribed'")
        {
            NewTranscriptionalMachinery.gameObject.renderer.material.color = new Color(0.800f, 0.500f, 0.118f);
        }
        else if (TM.Subtype == "'Crick-Paused'" || TM.Subtype == "'Watson-Paused'")
        {
            NewTranscriptionalMachinery.gameObject.renderer.material.color = new Color(0.874f, 0.412f, 0.118f);
        }
        else
        {
            NewTranscriptionalMachinery.gameObject.renderer.material.color = new Color(0.855f, 0.647f, 0.125f);
        }

        return(NewTranscriptionalMachinery);
    }
Esempio n. 6
0
    public static void ChangeNuc(ObjectsOnDNA toChange, string newSub, float convertPos)
    {
        GameObject[] nucleosomes = GameObject.FindGameObjectsWithTag("Nucleosome");

        foreach (GameObject nuc in nucleosomes)
        {
            if (nuc.transform.position.x == convertPos)
            {
                if (newSub == "'Binding'")
                {
                    nuc.gameObject.renderer.material.color = new Color(0.2f, 0.4f, 0.5f);
                }
                else if (newSub == "'Unbinding'")
                {
                    nuc.gameObject.renderer.material.color = new Color(0, 1, 1);
                }
                else if (newSub == "'Stable'")
                {
                    nuc.gameObject.renderer.material.color = new Color(0, 0, 1);
                }
            }
        }
    }
Esempio n. 7
0
    public static GameObject CreateNucleosome(ObjectsOnDNA Nucleosome)
    {
        GameObject[] nucleosomes = GameObject.FindGameObjectsWithTag("Nucleosome");

        GameObject NewNucleosome;

        var proceedWithCreation = true;


        var tempStartPos = Nucleosome.StartPosition + (Nucleosome.Length / 4);
        var convertPos   = (tempStartPos / 3.5f) - .6f;

        foreach (GameObject nuc in nucleosomes)
        {
            if (Math.Abs(nuc.transform.position.x - convertPos) <= 10 && nuc.transform.position.y == 12.5f)
            {
                iTween.MoveTo(nuc, new Vector3(convertPos, 0.3f, 0), 1f);

                proceedWithCreation = false;
            }
        }

        if (proceedWithCreation == true)
        {
            //NewNucleosome = (GameObject) GameObject.Instantiate((Resources.Load<GameObject>("Nucleosome")));
            //NewNucleosome.AddComponent("MeshRenderer");
            NewNucleosome = GameObject.CreatePrimitive(PrimitiveType.Sphere);

            if (Nucleosome.StartPosition != 0)
            {
                NewNucleosome.transform.localScale = new Vector3(Nucleosome.Length / 3.5f, Nucleosome.Length / 6f, Nucleosome.Length / 3.5f);                  // Scale extends on both sides, so is a bad ultimate choice
            }
            else
            {
                NewNucleosome.transform.localScale = new Vector3(Nucleosome.Length / 3.5f, Nucleosome.Length / 3f, Nucleosome.Length / 3.5f);
            }

            NewNucleosome.renderer.material.shader = specular;

            Nucleosome.StartPosition += Nucleosome.Length / 4;

            //		NewNucleosome.transform.position = new Vector3 ((Nucleosome.StartPosition / 3.5f) - 0.6f, 0.3f, 0);

            NewNucleosome.transform.position = new Vector3(10, 25, 0);
            iTween.MoveTo(NewNucleosome, new Vector3((Nucleosome.StartPosition / 3.5f) - 0.6f, 0.3f, 0), 1.5f);

            NewNucleosome.name = "Nucleosome";
            NewNucleosome.tag  = "Nucleosome";

            // Nucleosome Color
            if (Nucleosome.Subtype == "'Binding'")
            {
                NewNucleosome.gameObject.renderer.material.color = new Color(0.2f, 0.4f, 0.5f);
            }
            else if (Nucleosome.Subtype == "'Unbinding'")
            {
                NewNucleosome.gameObject.renderer.material.color = new Color(0, 1, 1);
            }
            else
            {
                NewNucleosome.gameObject.renderer.material.color = new Color(0, 0, 1);
            }

            return(NewNucleosome);
        }
        else
        {
            //	MEANINGLESS VALUE ---> JUST TO MAKE SURE IT RETURNS A VALUE
            return(NewNucleosome = GameObject.FindGameObjectWithTag("Nucleosome"));
        }
    }
    public static GameObject CreateTranscriptionFactor(ObjectsOnDNA TF)
    {
        GameObject[] transcriptionFactors = GameObject.FindGameObjectsWithTag("TranscriptionFactor");

        GameObject NewTranscriptionFactor;

        var proceedWithCreation = true;


        var tempStartPos = TF.StartPosition + (TF.Length / 3.5f);
        var convertPos   = (tempStartPos / 3.5f) - .6f;

        foreach (GameObject tFactor in transcriptionFactors)
        {
            if (tFactor.transform.position.x == convertPos && tFactor.transform.position.y == 12.5f)
            {
                if (TF.Subtype == "'POLY_A'")
                {
                    iTween.MoveTo(tFactor, new Vector3(convertPos, -0.5f, -0.5f), 2f);
                    proceedWithCreation = false;
                }
                else
                {
                    iTween.MoveTo(tFactor, new Vector3(convertPos, 0.3f, 0), 2f);
                    proceedWithCreation = false;
                }
            }
        }



        if (proceedWithCreation == true)
        {
            // Transcription Factor Color
            if (TF.Subtype == "'REB1'")
            {
                NewTranscriptionFactor = (GameObject)GameObject.Instantiate((Resources.Load <GameObject>("REB1")));
                NewTranscriptionFactor.transform.localScale     = new Vector3(TF.Length / 3.5f, TF.Length / 3.5f, TF.Length / 3.5f);                            // Scale extends on both sides, so is a bad ultimate choice
                NewTranscriptionFactor.renderer.material.shader = specular;

                TF.StartPosition += TF.Length / 3.5f;

                NewTranscriptionFactor.transform.position = new Vector3(15, 25, 0);
                iTween.MoveTo(NewTranscriptionFactor, new Vector3((TF.StartPosition / 3.5f) - 0.6f, 0.3f, 0), 1.5f);

                NewTranscriptionFactor.name = "TranscriptionFactor";
                NewTranscriptionFactor.tag  = "TranscriptionFactor";
                NewTranscriptionFactor.gameObject.renderer.material.color = new Color(1, 0, 1);

                return(NewTranscriptionFactor);
            }
            else if (TF.Subtype == "'POLY_A'")
            {
                //This TF is not the correct one! Poly A could not be created from a pdb
                NewTranscriptionFactor = (GameObject)GameObject.Instantiate((Resources.Load <GameObject>("STE13")));

//				GameObject NewTranscriptionFactor = GameObject.CreatePrimitive (PrimitiveType.Cube);


//				NewTranscriptionFactor.transform.localScale = new Vector3 (TF.Length / 3.5f, TF.Length / 3.5f, TF.Length / 3.5f);		// Scale extends on both sides, so is a bad ultimate choice
                NewTranscriptionFactor.transform.localScale = new Vector3(TF.Length, TF.Length, TF.Length);                             // Scale extends on both sides, so is a bad ultimate choice


                TF.StartPosition += TF.Length / 3.5f;

                NewTranscriptionFactor.transform.position = new Vector3(15, 25, 0);

//				iTween.MoveTo (NewTranscriptionFactor, new Vector3 ((TF.StartPosition / 3.5f) - 0.6f, 0.3f, 0), 1.5f);
                iTween.MoveTo(NewTranscriptionFactor, new Vector3((TF.StartPosition / 3.5f) - 0.6f, -.5f, -0.5f), 1.5f);


                NewTranscriptionFactor.name = "TranscriptionFactor";
                NewTranscriptionFactor.tag  = "TranscriptionFactor";
                return(NewTranscriptionFactor);
            }
            else if (TF.Subtype == "'TBP'")
            {
                NewTranscriptionFactor = (GameObject)GameObject.Instantiate((Resources.Load <GameObject>("TBP")));
                NewTranscriptionFactor.transform.localScale     = new Vector3(TF.Length / 3.5f, TF.Length / 3.5f, TF.Length / 3.5f);                            // Scale extends on both sides, so is a bad ultimate choice
                NewTranscriptionFactor.renderer.material.shader = specular;

                TF.StartPosition += TF.Length / 3.5f;

                NewTranscriptionFactor.transform.position = new Vector3(15, 25, 0);
                iTween.MoveTo(NewTranscriptionFactor, new Vector3((TF.StartPosition / 3.5f) - 0.6f, 0.3f, 0), 1.5f);

                NewTranscriptionFactor.name = "TranscriptionFactor";
                NewTranscriptionFactor.tag  = "TranscriptionFactor";
                NewTranscriptionFactor.gameObject.renderer.material.color = new Color(0.6f, 1, 0.3f);
                return(NewTranscriptionFactor);
            }
            else if (TF.Subtype == "'MCM1'")
            {
                NewTranscriptionFactor = GameObject.CreatePrimitive(PrimitiveType.Cube);
                NewTranscriptionFactor.transform.localScale     = new Vector3(TF.Length / 3.5f, TF.Length / 3.5f, TF.Length / 3.5f);                            // Scale extends on both sides, so is a bad ultimate choice
                NewTranscriptionFactor.renderer.material.shader = specular;

                TF.StartPosition += TF.Length / 3.5f;

                NewTranscriptionFactor.transform.position = new Vector3(15, 25, 0);
                iTween.MoveTo(NewTranscriptionFactor, new Vector3((TF.StartPosition / 3.5f) - 0.6f, 0.3f, 0), 1.5f);

                NewTranscriptionFactor.name = "TranscriptionFactor";
                NewTranscriptionFactor.tag  = "TranscriptionFactor";
                NewTranscriptionFactor.gameObject.renderer.material.color = new Color(0.729f, 0.333f, 0.827f);
                return(NewTranscriptionFactor);
            }
            else if (TF.Subtype == "'DAL80'")
            {
                NewTranscriptionFactor = (GameObject)GameObject.Instantiate((Resources.Load <GameObject>("DAL80")));
                NewTranscriptionFactor.transform.localScale = new Vector3(TF.Length / 100f, TF.Length / 100f, TF.Length / 100f);                                // Scale extends on both sides, so is a bad ultimate choice

                TF.StartPosition += TF.Length / 3.5f;

                NewTranscriptionFactor.transform.position = new Vector3(15, 25, 0);
                iTween.MoveTo(NewTranscriptionFactor, new Vector3((TF.StartPosition / 3.5f) - 0.6f, 0.3f, 0), 1.5f);

                NewTranscriptionFactor.name = "TranscriptionFactor";
                NewTranscriptionFactor.tag  = "TranscriptionFactor";
                return(NewTranscriptionFactor);
            }
            else if (TF.Subtype == "'FLO8'")
            {
                Debug.Log("flooooooooooo8 created");
                NewTranscriptionFactor = (GameObject)GameObject.Instantiate((Resources.Load <GameObject>("FLO8")));
                NewTranscriptionFactor.transform.localScale = new Vector3(TF.Length / 550f, TF.Length / 550f, TF.Length / 550f);                                // Scale extends on both sides, so is a bad ultimate choice


                TF.StartPosition += TF.Length / 3.5f;

                NewTranscriptionFactor.transform.position = new Vector3(15, 25, 0);
                //CHAD CHANGED THIS! Y COORDINATE WAS AT 0.3f
                iTween.MoveTo(NewTranscriptionFactor, new Vector3((TF.StartPosition / 3.5f) - 0.6f, 0f, 0), 1.5f);
                NewTranscriptionFactor.name = "TranscriptionFactor";
                NewTranscriptionFactor.tag  = "TranscriptionFactor";

                return(NewTranscriptionFactor);
            }
            else
            {
                NewTranscriptionFactor = GameObject.CreatePrimitive(PrimitiveType.Cube);
                NewTranscriptionFactor.transform.localScale     = new Vector3(TF.Length / 3.5f, TF.Length / 3.5f, TF.Length / 3.5f);                            // Scale extends on both sides, so is a bad ultimate choice
                NewTranscriptionFactor.renderer.material.shader = specular;

                TF.StartPosition += TF.Length / 3.5f;

                NewTranscriptionFactor.transform.position = new Vector3(15, 25, 0);
                iTween.MoveTo(NewTranscriptionFactor, new Vector3((TF.StartPosition / 3.5f) - 0.6f, 0.3f, 0), 1.5f);

                NewTranscriptionFactor.name = "TranscriptionFactor";
                NewTranscriptionFactor.tag  = "TranscriptionFactor";
                return(NewTranscriptionFactor);
            }
        }
        else
        {
            NewTranscriptionFactor = GameObject.FindGameObjectWithTag("TranscriptionFactor");
            return(NewTranscriptionFactor);
        }
    }
Esempio n. 9
0
    public static void DeleteObject(ObjectsOnDNA toDelete)
    {
        GameObject[] nucleosomes                = GameObject.FindGameObjectsWithTag("Nucleosome");
        GameObject[] transcriptionFactors       = GameObject.FindGameObjectsWithTag("TranscriptionFactor");
        GameObject[] transcriptionalMachineries = GameObject.FindGameObjectsWithTag("TranscriptionalMachinery");

        //toDelete.StartPosition has to be converted to nucleotide location
        float convertPos   = 0;
        float tempStartPos = 0;

        if (toDelete.MainType == "'Nucleosome'")
        {
            tempStartPos = toDelete.StartPosition + (toDelete.Length / 4);
            convertPos   = (tempStartPos / 3.5f) - .6f;
        }
        else if (toDelete.MainType == "'Transcription_Factor'")
        {
            tempStartPos = toDelete.StartPosition + (toDelete.Length / 3.5f);
            convertPos   = (tempStartPos / 3.5f) - .6f;
        }
        else if (toDelete.MainType == "'Transcriptional_Machinery'")
        {
            tempStartPos = toDelete.StartPosition + (toDelete.Length / 3.5f);
            convertPos   = (tempStartPos / 3.5f) - .6f;
        }


        foreach (GameObject nuc in nucleosomes)
        {
            if (nuc.transform.position.x == convertPos)
            {
                iTween.MoveTo(nuc, new Vector3(10, -25, 0), 2f);
//				iTween.MoveTo (nuc, new Vector3 (convertPos, -20, -5), 0.1f);
            }
        }

        foreach (GameObject nuc in nucleosomes)
        {
            if (nuc.transform.position.y == -25)
            {
                GameObject.Destroy(nuc);
            }
        }


        foreach (GameObject tf in transcriptionFactors)
        {
            if (tf.transform.position.x == convertPos)
            {
                iTween.MoveTo(tf, new Vector3(convertPos, -25, -5), 2f);
            }
        }

        foreach (GameObject tf in transcriptionFactors)
        {
            if (tf.transform.position.y == -25)
            {
                GameObject.Destroy(tf);
            }
        }



        foreach (GameObject tm in transcriptionalMachineries)
        {
            if (tm.transform.position.x == convertPos)
            {
                iTween.MoveTo(tm, new Vector3(convertPos, -20, -5), 2f);
//				GameObject.Destroy (tm);
            }
        }

        foreach (GameObject tm in transcriptionalMachineries)
        {
            if (tm.transform.position.y == -20)
            {
                GameObject.Destroy(tm);
            }
        }
    }
Esempio n. 10
0
 void Awake()
 {
     instance = this;
 }
Esempio n. 11
0
 // Constructor
 public InstructionObject(ObjectsOnDNA TO, string instruct)
 {
     TranscriptionSimObject = TO;
     instruction            = instruct;
 }
Esempio n. 12
0
    public IEnumerator parseList(LinkedList <List <InstructionObject> > ll)
    {
        LinkedListNode <List <InstructionObject> > cursor;

        cursor = ll.First;


        while (cursor != null)
        {
//			yield return StartCoroutine_Auto (TimeStep.instance.JustWait ());

            foreach (InstructionObject current in cursor.Value)
            {
                int  x;
                bool isNumeric = int.TryParse(current.instruction, out x);
                Debug.Log("CHAAAAAAAAAAAAAAAAAAAD" + x);

                //Create TF
                if (current.instruction == "TranscriptionFactorClass.CreateTranscriptionFactor")
                {
                    yield return(TranscriptionFactorClass.CreateTranscriptionFactor(current.TranscriptionSimObject));
                }

                //Create Nucleosome
                if (current.instruction == "NucleosomeClass.CreateNucleosome")
                {
                    yield return(NucleosomeClass.CreateNucleosome(current.TranscriptionSimObject));
                }

                //Create TM
                if (current.instruction == "TranscriptionalMachineryClass.CreateTranscriptionalMachinery")
                {
                    yield return(TranscriptionalMachineryClass.CreateTranscriptionalMachinery(current.TranscriptionSimObject));
                }

                //Delete ObjectsOnDNA
                if (current.instruction == "ObjectsOnDNA.DeleteObject")
                {
                    Debug.Log("Here " + current.TranscriptionSimObject.MainType);
                    ObjectsOnDNA.DeleteObject(current.TranscriptionSimObject);
                    yield return(0);
                }

                //Move Handling
                else if (isNumeric)
                {
                    //Extract coordinates and place into xyz array


                    GameObject[] nucleosomes                = GameObject.FindGameObjectsWithTag("Nucleosome");
                    GameObject[] transcriptionFactors       = GameObject.FindGameObjectsWithTag("TranscriptionFactor");
                    GameObject[] transcriptionalMachineries = GameObject.FindGameObjectsWithTag("TranscriptionalMachinery");

                    float convertPos = (current.TranscriptionSimObject.StartPosition / 3.5f) - .6f;

                    //Nucleosome move handling
                    if (current.TranscriptionSimObject.MainType == "Nucleosome")
                    {
                        foreach (GameObject nuc in nucleosomes)
                        {
                            if (convertPos == nuc.transform.position.x)
                            {
                                Debug.Log("Nuc positions equal");

                                syncList.Add(new syncObj(nuc, x));
                                //iTween.MoveTo(nuc, iTween.Hash("x", x, "time", 5));

                                current.TranscriptionSimObject.StartPosition = x;
                                nuc.transform.position = new Vector3((x / 3.5f) - .6f, .3f, 0);
                            }
                            else
                            {
                                Debug.Log("Nucleosomes not equal");
                                Debug.Log("ConvertPos = " + convertPos + " Current.start = " + current.TranscriptionSimObject.StartPosition + " Nuc.start = " + nuc.transform.position.x);
                            }
                        }
                    }

                    //Transcription Factor move handling
                    if (current.TranscriptionSimObject.MainType == "Transcription_Factor")
                    {
                        foreach (GameObject tf in transcriptionFactors)
                        {
                            if (convertPos == tf.transform.position.x)
                            {
                                Debug.Log("TF positions equal");

                                syncList.Add(new syncObj(tf, x));
                                //iTween.MoveTo(tf, iTween.Hash("x", xyz[0], "time", 5));

                                current.TranscriptionSimObject.StartPosition = x;
                                tf.transform.position = new Vector3((x / 3.5f) - .6f, .3f, 0);
                            }
                        }
                    }

                    //Transcriptional Machinery move handling
                    if (current.TranscriptionSimObject.MainType == "Transcriptional_Machinery")
                    {
                        foreach (GameObject tm in transcriptionalMachineries)
                        {
                            if (convertPos == tm.transform.position.x)
                            {
                                Debug.Log("TM positions equal");

                                syncList.Add(new syncObj(tm, x));

                                //iTween.MoveTo(tm, iTween.Hash("x", convertPos, "time", 5));

                                current.TranscriptionSimObject.StartPosition = x;
                                tm.transform.position = new Vector3((x / 3.5f) - .6f, .3f, 0);
                            }
                            else
                            {
                                Debug.Log("ConvertPos = " + convertPos + " Current.start = " + current.TranscriptionSimObject.StartPosition + " TM.start = " + tm.transform.position.x);
                            }
                        }
                    }
                }

                if (current.instruction == "JustWait")
                {
                    Debug.Log("KNOWS TO WAIT");
                    yield return(TimeStep.instance.JustWait());

                    Debug.Log("TRIED TO WAIT");
                }

                foreach (syncObj s in syncList)
                {
                    Debug.Log("obj shit" + s.gObj.name);
                    iTween.MoveTo(s.gObj, iTween.Hash("x", s.coord, "time", 5));
                    Debug.Log("Sync coords: " + s.coord);
                }
            }
            yield return(new WaitForSeconds(6));

            syncList.Clear();
            cursor = cursor.Next;
        }
    }