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); }
private void UpdateRotation(Timer.TimesPerSecondTimer caller) { transform.rotation = Quaternion.Euler(0, currentAngle, 0); currentAngle += Angle; }
private void UpdateSim(Timer.TimesPerSecondTimer caller) => ProcessGameOfLife();
private void Start() { rotateTimer = Timer.TimesPerSecond(TimesPerSecond); rotateTimer.Hit += UpdateRotation; }