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)); }
IEnumerable <Updraw> GetOutCutscene(SoundEffectInstance engineSound) { // Cars dont work yield return(new UpdrawDelay(60 * 2)); foreach (var item in driveCars) { item.engineOn = false; } yield return(new UpdrawLerp(60, f => engineSound.Volume = 1f - f)); engineSound.Stop(); engineSound.Dispose(); yield return(new RaceDialogueLevel1()); // Talk // Get out player.enabled = true; friend.enabled = true; player.PosX -= 3; yield return(new UpdrawDelay(30)); yield return(new UpdrawDo(23, () => { player.moveInput = new Vector2(0f, 1f); })); yield return(new UpdrawDelay(1)); yield return(new UpdrawDo(13, () => { player.moveInput = new Vector2(1f, 0f); })); yield return(new UpdrawDelay(10)); PlayerCar myCar = Race.instance.Entities.Find(f => f is PlayerCar) as PlayerCar; yield return(new UpdrawDo(60 * 3, () => { player.moveInput = (myCar.Pos - player.Pos); //moveInput = new Vector2(0f, -1f); })); player.blockInput = false; yield return(new ControlDisplay(() => !won.HasValue)); }