public TuningScreen(float height, int index) { if (instance != null) { throw new Exception(); } instance = this; this.height = height; screenView = new M_Rectangle(0, 0, G.ResX, G.ResY); screenMatrix = Matrix.CreateScale(G.ResY / 1080f * 4f); screenMatrixInverse = Matrix.Invert(screenMatrix); screenView.Transform(screenMatrixInverse); stateMachine = new UpdrawEnumerator(StateMachine()); playerPos = screenView.BottomLeft + new Vector2(225, 0); friendPos = screenView.BottomLeft + new Vector2(350, 0); friendPos.X -= index * 25f; if (index >= 2) { offsets[0].X = -10000; } if (index >= 3) { offsets[1].X = -10000; } }
public Race(List <Entity> entities, bool[,] street) { this.Entities = entities; this.street = street; width = street.GetLength(0); height = street.GetLength(1); tiles = new Tile[width, height]; player = entities.Find(f => f is Player) as Player; friend = entities.Find(f => f is Friend) as Friend; PlayerCar playerCar = entities.Find(f => f is PlayerCar) as PlayerCar; player.Pos = playerCar.Pos; for (int i = 0; i < entities.Count; i++) { OnAfterAddEntity(entities[i]); } if (instance != null) { throw new Exception(); } instance = this; camera = new Camera() { moveSpeed = 0.1f, }; #if DEBUG camera.zoomControl = true; #endif camera.zoom = camera.targetZoom = G.ResY / 1080f * 4f; camera.targetPos = player.Pos; camera.JumpToTarget(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { tiles[x, y] = new Tile() { indexX = 3, indexY = 2 }; } } UpdateTiles(0, width, 0, height); screenMatrixInverse = Matrix.Invert(screenMatrix); screenView = new M_Rectangle(0, 0, G.ResX, G.ResY); screenView.Transform(screenMatrixInverse); gameState = new UpdrawEnumerator(GetRaceEnumerable(Ingame.instance.level)); }
public UpdrawTrafficLights(Action onFadeOut, int level) { this.level = level; this.onFadeOut = onFadeOut; colors = new Color[3]; for (int i = 0; i < colors.Length; i++) { colors[i] = Color.Gray; } state = new UpdrawEnumerator(GetStates()); }
public Ingame(SpriteBatch spriteBatch, GraphicsDevice gDevice) { if (instance != null) { throw new Exception(); } instance = this; this.spriteBatch = spriteBatch; this.gDevice = gDevice; screen = new UpdrawEnumerator(WholeGame()); music = Music.dialogueMusic.CreateInstance(); music.IsLooped = true; music.Volume = 0.3f; music.Play(); }