Source

HI-2DRTSSGMDDPP1 / GameProgram / GameProgram / StarSystem.cs

Full commit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace GameProgram
{
  public class StarSystem : GameEntity
  {
    private List<PlanetarySystem> planetarySystems = new List<PlanetarySystem>();
    private Star star;

    public Star Star
    {
      get
      {
        throw new System.NotImplementedException();
      }
      set
      {
        star = value;
      }
    }

    public PlanetarySystem PlanetarySystem
    {
      get
      {
        throw new System.NotImplementedException();
      }
      set
      {
      }
    }

    internal Planet getPlanetAtRandom()
    {
      return planetarySystems[0].Planet;
    }

    internal void addPlanetarySystem( GameProgram.PlanetarySystem newPlanetarySystem )
    {
      planetarySystems.Add( newPlanetarySystem );
    }

    public override List<VisableGameEntity> getChildVisableGameEntities()
    {
      List<VisableGameEntity> visableGameEntities = new List<VisableGameEntity>();

      visableGameEntities.Add( star );

      foreach (PlanetarySystem planetarySystem in planetarySystems)
      {
        visableGameEntities.AddRange(planetarySystem.getChildVisableGameEntities());
      }

      return visableGameEntities;
    }

    public override void update( GameTime gameTime )
    {
      star.update( gameTime );

      foreach (PlanetarySystem planetarySystem in planetarySystems)
      {
        planetarySystem.update( gameTime );
      }
    }
  }
}