Exemplo n.º 1
0
        private void Awake()
        {
            perSecondTimer      = Timer.TimesPerSecond(TimesPerSecond);
            perSecondTimer.Hit += UpdateSim;

            var patternsManager = new GoLPatternsManager(new GoLPatternsResourcesLoader().Load());

            PatternWalker          = new ListWalker <GoLPattern>(patternsManager.Patterns);
            PatternWalker.Changed += PatternWalkerOnChanged;
            SetSelectedPatternTexture(new GoLPatternTexture(PatternWalker.Current));
            SelectedPresetTexture.Changed += SelectedPresetTextureOnChanged;

            outputTexture = new RenderTexture((int)size.x, (int)size.y, 24);
            outputTexture.enableRandomWrite = true;
            outputTexture.filterMode        = FilterMode.Point;
            outputTexture.Create();

            bufferTexture = new RenderTexture((int)size.x, (int)size.y, 24);
            bufferTexture.enableRandomWrite = true;
            bufferTexture.filterMode        = FilterMode.Point;
            bufferTexture.Create();

            gameOfLifeRawImage.texture = outputTexture;
            gameOfLifeRawImage.GetComponent <RectTransform>().sizeDelta = size;

            mouseCameraController.Initialize(size);

            GenerateRandomWorldGPU(Seed);

            gameOfLifeComputeShader.SetFloats("Resolution", outputTexture.width, outputTexture.height);
            gameOfLifeComputeShader.SetTexture(0, "Result", outputTexture);
            gameOfLifeComputeShader.SetTexture(0, "BufferTexture", bufferTexture);
        }
Exemplo n.º 2
0
 private void UpdateRotation(Timer.TimesPerSecondTimer caller)
 {
     transform.rotation = Quaternion.Euler(0, currentAngle, 0);
     currentAngle      += Angle;
 }
Exemplo n.º 3
0
 private void UpdateSim(Timer.TimesPerSecondTimer caller) => ProcessGameOfLife();
Exemplo n.º 4
0
 private void Start()
 {
     rotateTimer      = Timer.TimesPerSecond(TimesPerSecond);
     rotateTimer.Hit += UpdateRotation;
 }