Ejemplo n.º 1
0
        public Starfield()
        {
            MinMaxPair r = new MinMaxPair(5, 25);
            MinMaxPair z = new MinMaxPair(1, 2);

            this.InitLocation(r, z);
        }
Ejemplo n.º 2
0
        /// <summary>Chooses a starting location for a start</summary>
        private void InitLocation(MinMaxPair r, MinMaxPair z)
        {
            Randomizer rand = new Randomizer();

            // choose a size
            double radius = r.Min + (r.Max - r.Min) * rand.Generator.NextDouble();

            // choose an angle position
            double polar = rand.RandomAngle();

            // set the X,Y position
            this._position = new Point(radius * Math.Cos(polar), radius * Math.Sin(polar));

            // set the Z position
            this._dis = z.Min + (z.Max - z.Min) * rand.Generator.NextDouble();
        }