Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (art != null && art.NeedsRedraw())
        {
            art.ApplyImageProcess();
            img = art.GetArtwork();
            renderer.material.mainTexture = img;
            Debug.Log("Image applied");
        }

        if (!PauseMenu.isPaused && Input.GetButtonDown("Fire2"))
        {
            img = new Texture2D(width, height, TextureFormat.ARGB32, true);
            art = new Artwork();
            textbox.Text("New image and genome");
        }

        if (!PauseMenu.isPaused && Input.GetButtonDown("Fire1"))
        {
            TWEANNGenotype geno = art.GetGenotype();
            geno.Mutate();
            textbox.Text("Mutating...");
            art = new Artwork(geno);
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (leftArt.NeedsRedraw())
        {
            leftArt.ApplyImageProcess();
            leftImg = leftArt.GetArtwork();
            leftRenderer.material.mainTexture = leftImg;
            Debug.Log("leftImg applied");
        }
        if (rightArt.NeedsRedraw())
        {
            rightArt.ApplyImageProcess();
            rightImg = rightArt.GetArtwork();
            rightRenderer.material.mainTexture = rightImg;
            Debug.Log("rightImg applied");
        }

        if (!PauseMenu.isPaused && Input.GetButtonDown("Fire2"))
        {
            leftImg  = new Texture2D(width, height, TextureFormat.ARGB32, true);
            rightImg = new Texture2D(width, height, TextureFormat.ARGB32, true);
            BuildArtworks();
            //leftArt = new Artwork(leftGeno);
            //rightArt = new Artwork(rightGeno);
        }

        if (!PauseMenu.isPaused && Input.GetButtonDown("Fire1"))
        {
            leftGeno  = new TWEANNGenotype(leftArt.GetGenotype().Copy());
            rightGeno = new TWEANNGenotype(rightArt.GetGenotype().Copy());


            TWEANNCrossover cr = new TWEANNCrossover(false);
            cr.Crossover(leftGeno, rightGeno);
            leftImg  = new Texture2D(width, height, TextureFormat.ARGB32, true);
            rightImg = new Texture2D(width, height, TextureFormat.ARGB32, true);
            leftArt  = new Artwork(leftGeno);
            rightArt = new Artwork(rightGeno);
        }
    }