Exemple #1
0
    public void EnzymesAI()
    {
        Nucleobase_View NucleobaseToComplement = Nucleobase_View.GetNucleobaseAtPosition(NucleobaseToComplementMarker.position);

        Nucleobase.types goodType = NucleobaseToComplement.getNucleobaseComplementType();

        Nucleobase_View NucleobaseToPluck_1 = null;
        Nucleobase_View NucleobaseToPluck_2 = null;

        Pluckables.ResetAvailables();

        if (Random.Range(0, 2) == 0)
        {
            NucleobaseToPluck_1 = Pluckables.GetNucleobaseOfType(goodType);
            NucleobaseToPluck_2 = Pluckables.GetRandomNucleobase();
        }
        else
        {
            NucleobaseToPluck_1 = Pluckables.GetRandomNucleobase();
            NucleobaseToPluck_2 = Pluckables.GetNucleobaseOfType(goodType);
        }


        if (NucleobaseToPluck_1 == null)
        {
            Debug.Log("First pluckable is null! Trying a random one.");
            NucleobaseToPluck_1 = Pluckables.GetRandomNucleobase();
        }

        if (NucleobaseToPluck_2 == null)
        {
            Debug.Log("Second pluckable is null! Trying a random one.");
            NucleobaseToPluck_2 = Pluckables.GetRandomNucleobase();
        }

        if (NucleobaseToPluck_1 == null || NucleobaseToPluck_2 == null)
        {
            Debug.LogError("Out of Nucleobases to pluck !?!?");
            return;
        }



        if (NucleobaseToPluck_1.transform.position.x < NucleobaseToPluck_2.transform.position.x)
        {
            LeftEnzyme.SelectNucleobase(NucleobaseToPluck_1);
            leftHasGoodAnswer = (NucleobaseToPluck_1.getNucleobaseType() == goodType);

            RightEnzyme.SelectNucleobase(NucleobaseToPluck_2);
            rightHasGoodAnswer = (NucleobaseToPluck_2.getNucleobaseType() == goodType);
        }
        else
        {
            LeftEnzyme.SelectNucleobase(NucleobaseToPluck_2);
            leftHasGoodAnswer = (NucleobaseToPluck_2.getNucleobaseType() == goodType);

            RightEnzyme.SelectNucleobase(NucleobaseToPluck_1);
            rightHasGoodAnswer = (NucleobaseToPluck_1.getNucleobaseType() == goodType);
        }
    }
Exemple #2
0
    public Nucleobase_View GetNucleobaseOfType(Nucleobase.types type)
    {
        foreach (Nucleobase_View nv in availableForPlucking)
        {
            if (nv.getNucleobaseType() == type)
            {
                availableForPlucking.Remove(nv);
                return(nv);
            }
        }

        return(null);
    }
Exemple #3
0
    public Nucleobase_View SpawnNucleobaseFromType(Nucleobase.types type)
    {
        switch (type)
        {
        case Nucleobase.types.A: return(Instantiate(AdeninePrefab).GetComponent <Nucleobase_View>());

        case Nucleobase.types.C: return(Instantiate(CytosinePrefab).GetComponent <Nucleobase_View>());

        case Nucleobase.types.G: return(Instantiate(GuaninePrefab).GetComponent <Nucleobase_View>());

        case Nucleobase.types.T: return(Instantiate(ThyminePrefab).GetComponent <Nucleobase_View>());

        default:
            throw new System.Exception("Invalid Nucleobase type!");
        }
    }