コード例 #1
0
ファイル: GameController.cs プロジェクト: Bering/LD34
    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);
        }
    }
コード例 #2
0
ファイル: GameController.cs プロジェクト: Bering/LD34
 public Nucleobase_View GetNucleobaseToComplement()
 {
     return(Nucleobase_View.GetNucleobaseAtPosition(NucleobaseToComplementMarker.position));
 }