Beispiel #1
3
        public PlanetViewer(Planet planet, OpenView openViewDelegate)
        {
            this.openViewDelegate = openViewDelegate;

            this.planet = planet;
            this.planet.Moved += new MovedEventHandler(planet_Moved);
            this.planet.Changed += new ChangedEventHandler(planet_Changed);

            InitializeComponent();

            planet_Changed(planet);
            planet_Moved(planet);
        }
Beispiel #2
0
        public PlanetViewer( Planet planet )
        {
            this.planet = planet;

            InitializeComponent();

            colorButton.BackColor = planet.Color;
        }
Beispiel #3
0
        public Planet CreatePlanet()
        {
            Planet p = new Planet(this);
            planets.Add(p);

            CreateSatellite();
            return p;
        }
Beispiel #4
0
        public PlanetViewer( Planet planet )
        {
            this.planet = planet;
            this.planet.Moved += new MovedEventHandler(planet_Moved);

            InitializeComponent();

            colorButton.BackColor = planet.Color;

            planet_Moved(planet);
        }
Beispiel #5
0
        public void CreateDoublePlanet()
        {
            Random rand = new Random();

            Planet p1 = new Planet(this);
            Planet p2 = new Planet(this);

            double period = rand.NextDouble() * 100 + 50;
            double startTime = rand.NextDouble() * 200;
            double orbitRadius = rand.NextDouble() * 4 + 5;

            p1.Movement = new CircularMovementStrategy(period, orbitRadius);
            p2.Movement = new CircularMovementStrategy(period, orbitRadius);

            p1.Animate(startTime);
            p2.Animate(startTime + period / 2);

            planets.Add(p1);
            planets.Add(p2);
        }
Beispiel #6
0
        public Planet CreatePlanet()
        {
            Planet p = new Planet(this);
            planets.Add(p);

            CreateSatellite();

            OnChanged(); // Вызываем обработку события изменения

            return p;
        }