Example #1
0
  initialize: function(){
    _.bindAll(this, 'addSystem','initSystems','render','renderSystems');

    this.empireCount = random.from1to(3);

    this.empires = new App.Collections.Empires([]);
    this.initEmpires();

    this.systemCount = this.empires.length + 5 + random.from1to(5);
    //this.systemCount = this.empires.length;
    //this.systemCount = 1;
    
    this.systems = new App.Collections.Systems([]);
    this.initSystems();

    this.render();

    console.log('=== Universe has ' + this.empires.length + ' Empires');
    console.log('                 ' + this.systems.length + ' Systems');
    console.log('                 ' + this.systems.reduce(function(a, system){
      a = a + system.planets.length;
      return a;
    }, 0) + ' Planets');

  },
Example #2
0
  initialize: function() {
    _.bindAll(this, 'addPlanet','initPlanets');

    this.set({
      id: uuid.v4()
    });

    this.starCount = 1;

    this.planetCount = random.from1to(3);
    //this.planetCount = 1;

    this.stars = new App.Collections.Stars();
    this.planets = new App.Collections.Planets();
    this.ships = new App.Collections.Ships();

    this.initStars();
    this.initPlanets();
    //console.log( ' * ' + ' ' + this.get('name') + ' has ' + this.planets.length + ' planets')

  },