/// <summary>
        /// Setup constructor
        /// </summary>
        /// <param name="modelFactory">Factory used to create this planet's model</param>
        /// <param name="rendererFactory">Factory used to create this planet's renderer</param>
        public AbstractPlanet( IPlanetModelFactory modelFactory, IPlanetRendererFactory rendererFactory )
        {
            Arguments.CheckNotNull( modelFactory, "modelFactory" );
            Arguments.CheckNotNull( rendererFactory, "rendererFactory" );

            m_Model = modelFactory.Create( this );
            m_Renderer = rendererFactory.Create( this );
        }
 /// <summary>
 /// Assigns this model to a planet model
 /// </summary>
 protected override void AssignToModel( IPlanetModel planetModel, bool remove )
 {
     if ( remove )
     {
         planetModel.Remove( this );
     }
     else
     {
         planetModel.Add( this );
     }
 }
        /// <summary>
        /// Setup constructor
        /// </summary>
        /// <param name="view">Planet view</param>
        /// <param name="template">Planetary template</param>
        /// <param name="model">Planet model instance</param>
        public PlanetTemplateViewController( IPlanetModelTemplateView view, IPlanetModelTemplate template, IPlanetModel model )
        {
            Arguments.CheckNotNull( view, "view" );
            Arguments.CheckNotNull( template, "template" );
            Arguments.CheckNotNull( model, "model" );
            m_View = view;
            m_Template = template;
            m_Model = model;

            m_View.PlanetModelTemplate = template;
            m_View.PlanetModel = model;
        }
Ejemplo n.º 4
0
        public void Construct(IPlanetModel model, IPlanetView view, IPlanetOwner planetOwner, IPlanetOwnersParameters ownerParameters,
                              IPopulationManager populationManager, IShipsManager shipsManager, SelectableObject selectableObject)
        {
            _view             = view;
            _model            = model;
            _shipsManager     = shipsManager;
            _selectableObject = selectableObject;

            owner             = planetOwner;
            _ownersParameters = ownerParameters;
            owner.onTagChanged.AddListener(OnOwnerChanged);

            _populationManager = populationManager;
            _populationManager.onPopulationExterminated.AddListener(ClearOwner);
        }
 /// <summary>
 /// Assigns this model to a planet model
 /// </summary>
 protected override void AssignToModel( IPlanetModel planetModel, bool remove )
 {
     planetModel.TerrainModel = remove ? null : this;
 }
 /// <summary>
 /// Assigns this model to a planet model
 /// </summary>
 protected override void AssignToModel( IPlanetModel planetModel, bool remove )
 {
     planetModel.AtmosphereModel = remove ? null : this;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Validates a planet model passed to the <see cref="PlanetModel"/> setter
 /// </summary>
 protected virtual void ValidatePlanetModel( IPlanetModel model )
 {
     Arguments.CheckNotNull( model, "model" );
 }
 /// <summary>
 /// Builds a planet model
 /// </summary>
 protected override void BuildPlanetModel( IPlanetModel planetModel, IPlanetEnvironmentModelFactory modelFactory, ModelTemplateInstanceContext context )
 {
     Units.Metres radius = Range.Mid( m_Radius, context.Random.NextDouble( ) );
     ( ( ISpherePlanetModel )planetModel ).Radius = radius;
     base.BuildPlanetModel( planetModel, modelFactory, context );
 }
 /// <summary>
 /// Validates a planet model passed to the <see cref="PlanetModel"/> setter
 /// </summary>
 protected override void ValidatePlanetModel( IPlanetModel model )
 {
     Arguments.CheckedNonNullCast<ISpherePlanetModel>( model, "model" );
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Creates a view used to edit the parameters of a planet template
 /// </summary>
 public IPlanetModelTemplateView CreatePlanetTemplateView( IPlanetModelTemplate template, IPlanetModel instance )
 {
     //	HACK: AP: Create a view and a controller that are dependent on the template type
     IPlanetModelTemplateView view;
     if ( template is ISpherePlanetModelTemplate )
     {
         view = new SpherePlanetModelTemplateViewControl( );
         new SpherePlanetTemplateViewController( ( ISpherePlanetModelTemplateView )view, ( ISpherePlanetModelTemplate )template, ( ISpherePlanetModel )instance );
     }
     else
     {
         throw new NotSupportedException( "Unsupported planet template type " + template.GetType( ) );
     }
     return view;
 }