Exemple #1
0
        private void RenderPlanetPreview(PlanetFactory factory)
        {
            if (!SetPreviews(PreviewType.Ingame, factory))
            {
                return;
            }
            if (factory == null)
            {
                return;
            }

            var manager = _ingamePreview.Manager;
            var sun     = _ingamePreview.SunId;

            var entity = factory.Sample(manager, null);

            if (entity > 0)
            {
                // Give it an ellipse path. This will not move the entity, but it'll allow
                // lighting.
                manager.AddComponent <EllipsePath>(entity).Initialize(sun, 0, 0, 0, MathHelper.TwoPi, 0);

                // If it has a radius, add the renderer indicating max bounds (if low and high differ).
                if (factory.Radius != null && factory.Radius.Low != factory.Radius.High)
                {
                    _ingamePreview.Manager.AddComponent <IngamePreviewControl.PlanetMaxBounds>(entity)
                    .MaxRadius = factory.Radius.High;
                }
            }
        }