public void InvokedTick() { this.watch.Reset(); this.watch.Start(); int playerTickIndex = this.playerTickIndex; while (this.tickingPlayers.Count > 0) { if (this.playerTickIndex >= this.tickingPlayers.Count) { this.playerTickIndex = 0; } HTNPlayer tickingPlayer = this.tickingPlayers[this.playerTickIndex]; if (Object.op_Inequality((Object)tickingPlayer, (Object)null) && Object.op_Inequality((Object)((Component)tickingPlayer).get_transform(), (Object)null) && !tickingPlayer.IsDestroyed) { tickingPlayer.Tick(); } ++this.playerTickIndex; if (this.playerTickIndex >= this.tickingPlayers.Count) { this.playerTickIndex = 0; } if (this.playerTickIndex == playerTickIndex || this.watch.Elapsed.TotalMilliseconds > (double)AiManager.ai_htn_player_tick_budget) { break; } } this.watch.Reset(); this.watch.Start(); int junkpilePlayerTickIndex = this.junkpilePlayerTickIndex; while (this.tickingJunkpilePlayers.Count > 0) { if (this.junkpilePlayerTickIndex >= this.tickingJunkpilePlayers.Count) { this.junkpilePlayerTickIndex = 0; } HTNPlayer tickingJunkpilePlayer = this.tickingJunkpilePlayers[this.junkpilePlayerTickIndex]; if (Object.op_Inequality((Object)tickingJunkpilePlayer, (Object)null) && Object.op_Inequality((Object)((Component)tickingJunkpilePlayer).get_transform(), (Object)null) && !tickingJunkpilePlayer.IsDestroyed) { tickingJunkpilePlayer.Tick(); } ++this.junkpilePlayerTickIndex; if (this.junkpilePlayerTickIndex >= this.tickingJunkpilePlayers.Count) { this.junkpilePlayerTickIndex = 0; } if (this.junkpilePlayerTickIndex == junkpilePlayerTickIndex || this.watch.Elapsed.TotalMilliseconds > (double)AiManager.ai_htn_player_junkpile_tick_budget) { break; } } this.watch.Reset(); this.watch.Start(); int animalTickIndex = this.animalTickIndex; while (this.tickingAnimals.Count > 0) { if (this.animalTickIndex >= this.tickingAnimals.Count) { this.animalTickIndex = 0; } HTNAnimal tickingAnimal = this.tickingAnimals[this.animalTickIndex]; if (Object.op_Inequality((Object)tickingAnimal, (Object)null) && Object.op_Inequality((Object)((Component)tickingAnimal).get_transform(), (Object)null) && !tickingAnimal.IsDestroyed) { tickingAnimal.Tick(); } ++this.animalTickIndex; if (this.animalTickIndex >= this.tickingAnimals.Count) { this.animalTickIndex = 0; } if (this.animalTickIndex == animalTickIndex || this.watch.Elapsed.TotalMilliseconds > (double)AiManager.ai_htn_animal_tick_budget) { break; } } }
public void InvokedTick() { this.watch.Reset(); this.watch.Start(); int num = this.playerTickIndex; do { if (this.tickingPlayers.Count <= 0) { break; } if (this.playerTickIndex >= this.tickingPlayers.Count) { this.playerTickIndex = 0; } HTNPlayer item = this.tickingPlayers[this.playerTickIndex]; if (item != null && item.transform != null && !item.IsDestroyed) { item.Tick(); } this.playerTickIndex++; if (this.playerTickIndex < this.tickingPlayers.Count) { continue; } this.playerTickIndex = 0; }while (this.playerTickIndex != num && this.watch.Elapsed.TotalMilliseconds <= (double)AiManager.ai_htn_player_tick_budget); this.watch.Reset(); this.watch.Start(); num = this.junkpilePlayerTickIndex; do { if (this.tickingJunkpilePlayers.Count <= 0) { break; } if (this.junkpilePlayerTickIndex >= this.tickingJunkpilePlayers.Count) { this.junkpilePlayerTickIndex = 0; } HTNPlayer hTNPlayer = this.tickingJunkpilePlayers[this.junkpilePlayerTickIndex]; if (hTNPlayer != null && hTNPlayer.transform != null && !hTNPlayer.IsDestroyed) { hTNPlayer.Tick(); } this.junkpilePlayerTickIndex++; if (this.junkpilePlayerTickIndex < this.tickingJunkpilePlayers.Count) { continue; } this.junkpilePlayerTickIndex = 0; }while (this.junkpilePlayerTickIndex != num && this.watch.Elapsed.TotalMilliseconds <= (double)AiManager.ai_htn_player_junkpile_tick_budget); this.watch.Reset(); this.watch.Start(); num = this.animalTickIndex; do { if (this.tickingAnimals.Count <= 0) { break; } if (this.animalTickIndex >= this.tickingAnimals.Count) { this.animalTickIndex = 0; } HTNAnimal hTNAnimal = this.tickingAnimals[this.animalTickIndex]; if (hTNAnimal != null && hTNAnimal.transform != null && !hTNAnimal.IsDestroyed) { hTNAnimal.Tick(); } this.animalTickIndex++; if (this.animalTickIndex < this.tickingAnimals.Count) { continue; } this.animalTickIndex = 0; }while (this.animalTickIndex != num && this.watch.Elapsed.TotalMilliseconds <= (double)AiManager.ai_htn_animal_tick_budget); }