IEnumerator SpawnEnemiesInRounds() { RoundState = E_RoundState.E_SPAWNING_ENEMIES; for (int i = 0; i < SpawnRounds.Length; i++) { RoundInfo round = SpawnRounds[i]; float delay = round.SpawnDelay; while (delay > 0) { if (EnemiesAlive.Count == 0 || EnemiesAlive.Count <= round.MinEnemiesFomLastRound) { break; } yield return(new WaitForSeconds(0.5f)); delay -= 0.5f; } for (int ii = 0; ii < round.Spawns.Length; ii++) { RoundInfo.SpawnInfo spawnInfo = round.Spawns[ii]; yield return(new WaitForSeconds(spawnInfo.SpawnDelay)); SpawnPointEnemy spawnpoint = GetAvailableSpawnPoint(spawnInfo.SpawnPoint == null || spawnInfo.SpawnPoint.Length == 0 ? SpawnPoints : spawnInfo.SpawnPoint); if (spawnInfo.RotateToPlayer) { Vector3 dir = Player.Instance.Agent.Position - spawnpoint.Transform.position; dir.Normalize(); spawnpoint.Transform.forward = dir; } GameObject enemy = Mission.Instance.GetHuman(spawnInfo.EnemyType, spawnpoint.Transform); while (enemy == null) { yield return(new WaitForSeconds(0.2f)); enemy = Mission.Instance.GetHuman(spawnInfo.EnemyType, spawnpoint.Transform); } CombatEffectsManager.Instance.PlaySpawnEffect(spawnpoint.Transform.position, spawnpoint.Transform.forward); Agent agent = enemy.GetComponent("Agent") as Agent; agent.PrepareForStart(); Mission.Instance.CurrentGameZone.AddEnemy(agent); EnemiesAlive.Add(agent); yield return(new WaitForSeconds(0.1f)); } } RoundState = E_RoundState.E_IN_PROGRESS; }
public Deathmatch(Deathmatch dm) { this._2 = (dm._2 == null) ? null : new RoundInfo(dm._2); this._4 = (dm._4 == null) ? null : new RoundInfo(dm._4); this._1 = (dm._1 == null) ? null : new RoundInfo(dm._1); this._3 = (dm._3 == null) ? null : new RoundInfo(dm._3); }
public void StartNextRound(NetworkedGameState gameState) { RoundInfo info = new RoundInfo(); info.floorName = SceneManager.GetActiveScene().name; //Debug.Log("Adding floor info for scene: \"" + info.floorName + "\""); info.floorStartTime = (float)(DateTime.Now - sessionStart).TotalSeconds; //Debug.Log("Floor started at: " + info.floorStartTime.ToString("0.000") + " seconds"); info.startingScores = new Dictionary <int, int>(); foreach (KeyValuePair <int, int> score in gameState.GetAllScores()) { info.startingScores[score.Key] = score.Value; //Debug.Log("Player" + score.Key + "'s starting score recorded as: " + score.Value); } info.tableyPlayerNum = SessionManager.Singleton.tabletPlayer; //Debug.Log("Mission Control player set to: " + info.tableyPlayerNum); info.interactions = new List <InteractionInfo>(); currentRoundActions = info.interactions; rounds.Add(info); }
public void PlayeTrack(string roundID, int trackID, int length) { //获取最近的回合信息 RoundInfo roundInfo = DataManager.Instance.GetRoundInfo(roundID); //获取轨迹信息 List <TrackInfo> trackInfoList = roundInfo.GetTargetTracksByIndex(trackID, length); if (trackInfoList == null) { Debug.LogError("获取轨迹为空"); return; } if (EventManager.ShowTrackInfo != null) { EventManager.ShowTrackInfo(trackInfoList[0]); } //按照轨迹顺序 播放轨迹 ResetPlayingData(); for (int i = 0; i < trackInfoList.Count; i++) { TrackInfo info = trackInfoList[i]; m_FramesToPlay.AddRange(info.FrameInfos); } PlayMode = PlayerMode.PlayTrack; //设置播放速度 m_RealTimeFrameInterval = DBFRAMETimeDelta / m_SpeedScale; m_TotalPlayTime = (m_FramesToPlay.Count - 1) * m_RealTimeFrameInterval; //总播放时长 //CameraManager.Instance.SetHawkEyeCameraActive(false); m_PlayingTrackList = trackInfoList; }
public void ArrangleBringFormationPrelude(CircularlyLinkedNode <IPlayer> player) { _currentRound = null; StartCountDown(player, p => OnPlayerBringFormationTimeout(player)); _playerControls[player].TakeOutButton.Enabled = true; }
public Rush(MemoryStream stream) { var pos = stream.Position; Attackers = new RoundInfo(stream, true); stream.Position = pos; Defenders = new RoundInfo(stream, false); }
public ActionResult DeleteConfirmed(int id) { RoundInfo roundInfo = db.RoundInfoes.Find(id); db.RoundInfoes.Remove(roundInfo); db.SaveChanges(); return(RedirectToAction("Index")); }
public PostRoundInfo(RoundInfo roundInfo, float points = 0, int gold = 0) { PlayerIndex = roundInfo.PlayerIndex; RoundNumber = roundInfo.RoundNumber; GameSceneName = roundInfo.GameSceneName; PointsGained = points; GoldGained = gold; }
public void ArrangeFollowFormationPrelude(CircularlyLinkedNode <IPlayer> player, RoundInfo roundInfo) { _currentRound = roundInfo; _playerControls[player].TakeOutButton.Enabled = true; _playerControls[player].PassButton.Enabled = true; StartCountDown(player, p => OnPlayerFollowFormationTimeout(player)); }
void onNotifyRoundEnd(RoundInfo roundInfo) { if (roundInfo.turn != Enemy) { return; } this.stopOutCard(); }
/// <summary> /// The speed in the next round will be equal to the speed in the current round /// plus 50 meters/second /// minus( (the number of fuel points burned) multiplied by 1 meter/second) /// </summary> public void CalculateNewSpeed(int burnDelta) { int speed = current.GetSpeed() + deltaSpeed - burnDelta; int height = current.GetHeight() - speed; fuel -= burnDelta; // create a new current and add it to the history mlh.AddRound(height: height, speed: speed); current = mlh.Last(); }
public ActionResult Index(int tabletDeviceNumber) { TabletDeviceStatus tabletDeviceStatus = AppData.TabletDeviceStatusList[tabletDeviceNumber]; ViewData["Title"] = $"Show Round Info - {tabletDeviceStatus.Location}"; ViewData["Header"] = $"{tabletDeviceStatus.Location}"; if (tabletDeviceStatus.TableNumber == 0) { SitoutRoundInfo sitoutRoundInfo = new SitoutRoundInfo(tabletDeviceNumber); ViewData["ButtonOptions"] = ButtonOptions.OKEnabled; return(View("Sitout", sitoutRoundInfo)); } // Update player names if not just immediately done in ShowPlayerNumbers TableStatus tableStatus = AppData.TableStatusList.Find(x => x.SectionID == tabletDeviceStatus.SectionID && x.TableNumber == tabletDeviceStatus.TableNumber); if (tabletDeviceStatus.NamesUpdateRequired) { tableStatus.RoundData.UpdateNames(tableStatus); } tabletDeviceStatus.NamesUpdateRequired = true; RoundInfo roundInfo = new RoundInfo(tabletDeviceNumber, tableStatus); Section section = AppData.SectionsList.Find(x => x.SectionID == tabletDeviceStatus.SectionID); if (tableStatus.RoundData.NumberNorth == 0 || tableStatus.RoundData.NumberNorth == section.MissingPair) { tableStatus.ReadyForNextRoundNorth = true; tableStatus.ReadyForNextRoundSouth = true; roundInfo.NSMissing = true; } else if (tableStatus.RoundData.NumberEast == 0 || tableStatus.RoundData.NumberEast == section.MissingPair) { tableStatus.ReadyForNextRoundEast = true; tableStatus.ReadyForNextRoundWest = true; roundInfo.EWMissing = true; } if (tabletDeviceStatus.RoundNumber == 1 || section.TabletDevicesPerTable > 1) { ViewData["ButtonOptions"] = ButtonOptions.OKEnabled; } else { // Back button needed if one tablet device per table, in case EW need to check their move details ViewData["ButtonOptions"] = ButtonOptions.OKEnabledAndBack; } if (AppData.IsIndividual) { return(View("Individual", roundInfo)); } else { return(View("Pair", roundInfo)); } }
public RoundInfo GetLatestRoundInfo() { RoundInfo info = null; string roundID = GetLatestRoundID(); if (!string.IsNullOrEmpty(roundID)) { info = GetRoundInfo(roundID); } return(info); }
public Task <StoreError> SetRound(int r, RoundInfo round) { roundCache.Add(r, round); if (r > lastRound) { lastRound = r; } return(Task.FromResult <StoreError>(null)); }
public async Task TestBadgerRounds() { var dbPath = GetPath(); var cacheSize = 0; var(store, participants) = await InitBadgerStore(cacheSize, dbPath, logger); var round = new RoundInfo(); var events = new Dictionary <string, Event>(); foreach (var p in participants) { var ev = new Event(new[] { new byte[] { } }, new BlockSignature[] {}, new[] { "", "" }, p.PubKey, 0); events[p.Hex] = ev; round.AddEvent(ev.Hex(), true); } StoreError err; using (var tx = store.BeginTx()) { err = await store.SetRound(0, round); Assert.Null(err); tx.Commit(); } var c = store.LastRound(); Assert.Equal(0, c); RoundInfo storedRound; (storedRound, err) = await store.GetRound(0); Assert.Null(err); storedRound.ShouldCompareTo(round); var witnesses = await store.RoundWitnesses(0); var expectedWitnesses = round.Witnesses(); Assert.Equal(expectedWitnesses.Length, witnesses.Length); foreach (var w in expectedWitnesses) { Assert.Contains(w, witnesses); } }
public Task <StoreError> DbSetRound(int index, RoundInfo round) { logger.Verbose("Db - SetRound"); var key = RoundKey(index); //insert [round_index] => [round bytes] tx.Insert(RoundPrefix, key, round); return(Task.FromResult <StoreError>(null)); }
private string GenerateRoundInfo(GameMap gameMap) { var roundInfo = new RoundInfo() { MapSeed = gameMap.MapSeed, Round = gameMap.CurrentRound, Winner = GetPlayerInfo(_engine.Winner), Players = _engine.Players.Select(GetPlayerInfo), LeaderBoard = _engine.LeaderBoard.Select(GetPlayerInfo) }; return(JsonConvert.SerializeObject(roundInfo)); }
public async Task <StoreError> SetRound(int r, RoundInfo round) { var err = await InMemStore.SetRound(r, round); if (err != null) { return(err); } err = await DbSetRound(r, round); return(err); }
// GET: Rounds/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RoundInfo roundInfo = db.RoundInfoes.Find(id); if (roundInfo == null) { return(HttpNotFound()); } return(View(roundInfo)); }
public async Task TestInmemRounds() { var(store, participants) = InitInmemStore(10); var round = new RoundInfo(); var events = new Dictionary <string, Event>(); foreach (var p in participants) { var ev = new Event(new[] { new byte[] { } }, new BlockSignature[] { }, new[] { "", "" }, p.PubKey, 0); events[p.Hex] = ev; round.AddEvent(ev.Hex(), true); } // Store Round var err = await store.SetRound(0, round); Assert.Null(err); RoundInfo storedRound; (storedRound, err) = await store.GetRound(0); Assert.Null(err); round.ShouldCompareTo(storedRound); // Check LastRound var c = store.LastRound(); Assert.Equal(0, c); // Check witnesses var witnesses = await store.RoundWitnesses(0); var expectedWitnesses = round.Witnesses(); Assert.Equal(expectedWitnesses.Length, witnesses.Length); foreach (var w in expectedWitnesses) { Assert.Contains(w, witnesses); } }
public RoundInfo GetRoundInfo(List <DBTrack> datalist) { RoundInfo info = new RoundInfo(); info.RoundID = datalist[0].roundID; info.TrackInfos = new List <TrackInfo>(); for (int i = 0; i < datalist.Count; i++) { info.TrackInfos.Add(GetTrackInfo(datalist[i])); } info.TrackInfos.Sort(Compare); return(info); }
/// <summary> /// When the windows loads /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Loaded(object sender, RoutedEventArgs e) { try { currentGame.StartGame(); currentRound = currentGame.GetCurrentRoundInfo(); UpdateDisplay(); uiUpdateTimer.Start(); } catch (Exception ex) { ex.Log(); } }
IEnumerator SpawnEnemysInRounds() { State = E_State.SpawnEnemys; for (int i = 0; i < SpawnRounds.Length; i++) { RoundInfo round = SpawnRounds[i]; float delay = round.SpwanDelay; while (delay > 0) { yield return(new WaitForSeconds(0.2f)); delay -= 0.2f; } for (int k = 0; k < round.Spwans.Length; k++) { RoundInfo.SpwanInfo spwanInfo = round.Spwans[k]; //出怪延时 yield return(new WaitForSeconds(spwanInfo.SpwanDelay)); SpwanPointEnemy[] temp; if (spwanInfo.SpwanPoint != null && spwanInfo.SpwanPoint.Length > 0) { temp = spwanInfo.SpwanPoint; } else { temp = SpwanPointEnemys; } //选择最佳出怪点 SpwanPointEnemy point = temp[0]; //改变怪物的朝像 if (spwanInfo.RotateToPlayer == true) { Vector3 playerPos = Vector3.zero; Vector3 dir = playerPos - point.transform.position; dir.Normalize(); point.transform.forward = dir; } //开场动画 yield return(new WaitForSeconds(0.5f)); Agent enemy = CreateEnemy(point, spwanInfo.EmemyType); //添加缓存 yield return(new WaitForSeconds(1.0f)); } } State = E_State.WaitAllDead; }
public static RoundInfo FromStringOne(string str) { string pattern = "(\\{\"id\":(\\d+),\"round\":\"(\\w+)\",\"num\":(\\d+),\"award\":\"(\\w+)\",\"addr\":(\\w+),\"remain\":(\\d+)\\})"; var match = Regex.Match(str, pattern); RoundInfo info = new RoundInfo() { Id = int.Parse(match.Groups[2].Value), round = int.Parse(match.Groups[3].Value), num = int.Parse(match.Groups[4].Value), award = match.Groups[5].Value, remain = int.Parse(match.Groups[7].Value) }; return(info); }
public static bool IsValidPlay(ICard card, List <ICard> allRemainingCards, RoundInfo info) { try { var valid = allRemainingCards.Contains(card) && (!info.CardsPlayedInRound.Any() || card.Suit == info.PlayedSuit || allRemainingCards.All(a => a.Suit != info.PlayedSuit)); return(valid); } catch (Exception e) { DebugConsole.Log(e.ToString()); return(false); } }
void QueueAttacks(int playerAttack, int enemyAttack) { RoundInfo roundInfo = new RoundInfo(); if (battleController.playerPokemonControl.effectiveStats.speed > battleController.enemyPokemonControl.effectiveStats.speed) { roundInfo.attackQueue.Enqueue(new Tuple <Pokemon, int, Pokemon>(battleController.playerPokemonControl, playerAttack, battleController.enemyPokemonControl)); roundInfo.attackQueue.Enqueue(new Tuple <Pokemon, int, Pokemon>(battleController.enemyPokemonControl, enemyAttack, battleController.playerPokemonControl)); } else { roundInfo.attackQueue.Enqueue(new Tuple <Pokemon, int, Pokemon>(battleController.enemyPokemonControl, enemyAttack, battleController.playerPokemonControl)); roundInfo.attackQueue.Enqueue(new Tuple <Pokemon, int, Pokemon>(battleController.playerPokemonControl, playerAttack, battleController.enemyPokemonControl)); } battleController.currentRoundInfo = roundInfo; }
public void ArrangleBringFormationPrelude(IPlayer specifiedPlayer) { if (specifiedPlayer == this.Player) { _currentRound = null; StartCountDown(this.lblCurrentCountdown, OnPlayerBringFormationTimeout); this.btnCurrentTakeOut.Enabled = true; } else if (specifiedPlayer == this.PlayerLeft) { StartCountDown(this.lblLeftCountdown); } else if (specifiedPlayer == this.PlayerRight) { StartCountDown(this.lblRightCountdown); } }
public static RoundInfo[] FromString(string str) { string pattern = "(\\{\"id\":(\\d+),\"round\":\"(\\w+)\",\"num\":(\\d+),\"award\":\"(\\w+)\",\"drawType\":(\\d+),\"addr\":(\\w+)\\})"; var matches = Regex.Matches(str, pattern); RoundInfo[] infos = new RoundInfo[matches.Count]; for (int i = 0; i < infos.Length; i++) { infos[i] = new RoundInfo() { Id = int.Parse(matches[i].Groups[2].Value), round = int.Parse(matches[i].Groups[3].Value), num = int.Parse(matches[i].Groups[4].Value), award = matches[i].Groups[5].Value }; } return(infos); }
public void ArrangeFollowFormationPrelude(IPlayer specifiedPlayer, RoundInfo roundInfo) { EndCountDown(); if (specifiedPlayer == this.Player) { _currentRound = roundInfo; this.btnCurrentTakeOut.Enabled = true; this.btnCurrentPassby.Enabled = true; StartCountDown(this.lblCurrentCountdown, OnPlayerFollowFormationTimeout); } else if (specifiedPlayer == this.PlayerLeft) { StartCountDown(this.lblLeftCountdown); } else if (specifiedPlayer == this.PlayerRight) { StartCountDown(this.lblRightCountdown); } }
public ActionResult Guess(int id) { _gameService.AnswerRound(id, GetUserIdFromSessionStorage()); RoundInfo roundInfo = _gameService.GetLatestRoundInfo(GetUserIdFromSessionStorage()); RoundAnsweredViewModel ravm = new RoundAnsweredViewModel { GameId = roundInfo.GameId, AmountOfRoundsPlayed = roundInfo.AmountOfRoundsPlayed, CorrectImageId = roundInfo.CorrectImageId, GuessedImageId = roundInfo.GuessedImageId, Name = roundInfo.Name, TotalRounds = roundInfo.TotalRounds, Images = roundInfo.Images.Select(x => new ImageViewModel { Id = x.Id, Url = x.Url }).ToList() }; return(View("RoundAnswered", ravm)); }
public RoundInfo GetRoundInfo(int roundId) {//TODO optimize RoundInfo roundInfo = new RoundInfo(); RoundEntity roundEntity = _roundRepository.Get(roundId); IEnumerable <ImageInRoundEntity> imageInRoundEntity = _imageInRoundRepository.GetAll().Where(x => x.RoundId == roundId); roundInfo.GameId = roundEntity.GameId; roundInfo.CorrectImageId = roundEntity.CorrectImageId; roundInfo.GuessedImageId = roundEntity.GuessedImageId.Value; roundInfo.Name = _imageRepository.Get(roundEntity.CorrectImageId).Name; roundInfo.Images = imageInRoundEntity.Select(x => new Image { Id = x.ImageId, Url = _imageRepository.Get(x.ImageId).Url }).ToList(); roundInfo.AmountOfRoundsPlayed = RoundsPlayedInGame(roundEntity.GameId); roundInfo.TotalRounds = ROUNDS_PER_GAME; return(roundInfo); }
/// <summary> /// The player starts with 500 fuel points, and on each turn, /// the player decides how many fuel points to have the rocket engines burn. /// The more fuel that's burned, the greater the effect on the Mars Lander's speed, /// as it falls towards Mars. /// The Lander starts at a distance of 1,000 meters above the surface of the planet, /// and in order to safely put the lander on Mars, it must reach the surface of Mars, /// and be traveling at no more than 10 meters/second when it does so. /// </summary> public MarsLander() { mlh.AddRound(height: initialHeight, speed: initialSpeed); current = mlh.Last(); }