// Used only for initializing variables public override void Setup() { this.lastFrame = 0; this.currentFrame = 0; this.framesBetweenUpdates = 40; this.rand = new Random(); this.lost = false; foreach (Cube cube in this.Cubes) { CubeWrapper wrapper = new CubeWrapper(this, cube); CubeWrapperSet.Add(wrapper); } }
public void Repaint() { // Paint colored cube black if (this.lastFrame > 0) this.ResetCube(this.coloredCubeWrapper); // Paint a random cube a random color int r = (this.currentFrame * 5 % 206) + 50; int g = (this.currentFrame * 4 % 206) + 50; int b = (this.currentFrame * 3 % 206) + 50; CubeWrapper[] arrCubes = this.CubeWrapperSet.ToArray(); this.coloredCubeWrapper = arrCubes[this.rand.Next(0, arrCubes.Length)]; Color color = new Color((byte)r, (byte)g, (byte)b); this.coloredCubeWrapper.cube.FillScreen(color); //this.coloredCubeWrapper.cube.Paint(); }
public void ResetCube(CubeWrapper cubeWrapper) { cubeWrapper.cube.FillScreen(new Color(0, 0, 0)); //cubeWrapper.cube.Paint(); }