Exemple #1
0
        private void Update()
        {
            perSecondTimer.TimesPerSecond = TimesPerSecond;

            if (simulate)
            {
                perSecondTimer.Tick();
            }

            if (Input.GetKeyDown(KeyCode.R))
            {
                GenerateRandomWorldGPU(Seed);
            }
            if (Input.GetKeyDown(KeyCode.N))
            {
                PatternWalker.Next();
            }
            if (Input.GetKeyDown(KeyCode.B))
            {
                PatternWalker.Previous();
            }
            if (Input.GetKeyDown(KeyCode.H))
            {
                ui.SetActive(!ui.activeSelf);
            }
            if (Input.GetMouseButtonDown(2))
            {
                SelectedPresetTexture.Rotate();
            }

            if (Input.GetMouseButtonDown(1))
            {
                Vector3 worldMousePosition   = mainCamera.ScreenToWorldPoint(Input.mousePosition);
                Vector2 textureMousePosition = new Vector2(worldMousePosition.x, worldMousePosition.y) + size / 2.0f;
                var     x = (int)textureMousePosition.x;
                var     y = (int)textureMousePosition.y;

                Graphics.CopyTexture(SelectedPresetTexture.Texture, 0, 0, 0, 0, SelectedPresetTexture.Texture.width,
                                     SelectedPresetTexture.Texture.height,
                                     outputTexture, 0, 0, x - SelectedPresetTexture.Texture.width / 2,
                                     y - SelectedPresetTexture.Texture.height / 2);
            }
        }
Exemple #2
0
 private void Update()
 {
     rotateTimer.TimesPerSecond = TimesPerSecond;
     rotateTimer.Tick();
 }