// Update is called once per frame
    void Update()
    {
        rotationY = (ROTATION_SPEED * Time.deltaTime) % 180;

        sculptureProp.transform.Rotate(0, rotationY, 0);
        if (!PauseMenu.isPaused && Input.GetButtonDown("Fire2"))
        {
            textbox.Text("New sculpture and genome");
            //Destroy(sculptureProp);
            //sculptureProp = Instantiate(sculptureObject) as GameObject;
            //sculptureProp.AddComponent<Sculpture>();
            //sculptureProp.transform.position = new Vector3(0, 1, 0);
            sculpture.NewSculpture();
        }


        if (!PauseMenu.isPaused && Input.GetButtonDown("Fire1"))
        {
            textbox.Text("Mutating...");
            rotSave = sculptureProp.transform.rotation.eulerAngles;
            sculptureProp.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
            DeleteOldVoxels();
            sculpture.Mutate();
            sculpture.Refresh();
            sculptureProp.transform.Rotate(rotSave);
        }

        if (!PauseMenu.isPaused && Input.GetButtonDown("Fire3"))
        {
            textbox.Text("Transparency: " + sculpture.ToggleTransparency());
        }
    }
Example #2
0
    public void MutateSculptures()
    {
        ArtGallery ag = ArtGallery.GetArtGallery();

        //Sort Sculptures
        Sculpture[]    toMutate          = new Sculpture[sculptures.Length];
        TWEANNGenotype sculptureChampion = null;

        for (int s = 0; s < sculptures.Length; s++)
        {
            if (sculptures[s].GetSelected())
            {
                sculptureChampion = new TWEANNGenotype(sculptures[s].GetGenotype().Copy());
                sculptures[s].SetSelected(false);
                toMutate[s] = sculptures[s];
            }
            else
            {
                toMutate[s] = sculptures[s];
            }
        }

        //Select sculpture champion and crossover / mutate
        if (sculptureChampion != null)
        {
            for (int m = 0; m < sculptures.Length; m++)
            {
                Sculpture ms = toMutate[m];
                if (ms != null)
                {
                    TWEANNGenotype  crossedGeno = new TWEANNGenotype(sculptureChampion.Copy());
                    TWEANNCrossover cross       = new TWEANNCrossover(false)
                    {
                        Sucessful = false
                    }; // HACK PROTOTYPE hardcoded value
                       //TWEANNGenotype crossedmgeno = cross.Crossover(new TWEANNGenotype(sculptureChampion.Copy()), new TWEANNGenotype(ms.GetGenotype().Copy()));
                       //crossedGeno = crossedmgeno;

                    for (int mr = 0; mr < Random.Range(2, ag.sculptureMutationChances); mr++) //HACK PROTOTYPE hardcoded value for mutation rate
                    {
                        crossedGeno.Mutate();
                    }

                    ms.NewSculpture(new TWEANNGenotype(crossedGeno));
                }
            }
        }
    }
Example #3
0
 public void ResetSculpture(Sculpture s)
 {
     s.NewSculpture();
 }