Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. Había dos que tenían que sobrevivir (por estar mejor adaptados) y murieron; ESTO SE REPITE. No esta funcionando la formula de adaptación. Parece que mueren de forma random.
  2.  
  3. private List<int> ProcessDeaths(MoveChobysMessage message, List<Choby> allChobys){
  4. List<int> deadChobys = new List<int>();
  5.  
  6. IEnumerable<IGrouping<EnvironmentType, Choby>> chobyGroups = allChobys.GroupBy(c => c.currentEnvironment);
  7. foreach (IGrouping<EnvironmentType, Choby> chobyGroup in chobyGroups) {
  8. Debug.Log("Chobi count in " + chobyGroup.Key + " is " + chobyGroup.Count());
  9. if(chobyGroup.Count() <= EvolutioConstants.MAX_ZONE_CHOBYS) continue;
  10. Debug.Log("Too many chobis in " + chobyGroup.Key);
  11.  
  12. List<Choby> orderedChobys = chobyGroup.OrderBy(c => c.adaptabilityScore[c.currentEnvironment]).ToList();
  13.  
  14. for (int i = EvolutioConstants.MAX_ZONE_CHOBYS; i < orderedChobys.Count; i++) {
  15. Debug.Log("Dead chobi (" + orderedChobys[i].id + ")");
  16. deadChobys.Add(orderedChobys[i].id);
  17. }
  18. }
  19.  
  20. PlayerAction action = ActionFactory.CreateKillChobysAction(message.messageOrigin, deadChobys);
  21. ActionMessage actionMessage = new ActionMessage {action = Newtonsoft.Json.JsonConvert.SerializeObject(action)};
  22. NetworkServer.SendToAll(ActionMessage.MessageTypeId, actionMessage);
  23.  
  24. return deadChobys;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement