コード例 #1
0
ファイル: SpawnManager.cs プロジェクト: emmett9001/Cybrid-7X
 public void RainSpawn(Cell c, List<GameEntity> nearby)
 {
     if (c.shouldSpawn(nearby) && cells.Count < limit){
     List<int> offspringTypes = c.OffspringTypes(nearby);
     int typeCounter = 0;
     for(int i = 0; i < c.newOffspringCount(nearby); i++){
       if(offspringTypes.Count == 0) break;
       SpawnCell(new Vector2 (c.sprite.Position.X+rng.Next(-20,20), c.sprite.Position.Y+rng.Next(-20,20)), offspringTypes[typeCounter]);
       if(typeCounter < offspringTypes.Count - 1){
     typeCounter++;
       } else{
     typeCounter = 0;
       }
     }
     c.hasReproduced = true;
       }
 }