public void Spawn(AsteroidFieldRenderer r)
            {
                var min = 0;
                var p   = new Vector3(
                    r.rand.NextFloat(-1, 1),
                    r.rand.NextFloat(-1, 1),
                    r.rand.NextFloat(-1, 1)
                    );

                Position = (p * r.field.FillDist);
                Size     = r.rand.NextFloat(r.field.BillboardSize.X, r.field.BillboardSize.Y) * 2;
                Texture  = r.rand.Next(0, 3);
            }
Exemplo n.º 2
0
            public void Spawn(AsteroidFieldRenderer r)
            {
                Inited = true;
                var dist  = r.rand.NextFloat(r.field.BillboardDistance, r.field.FillDist);
                var theta = r.rand.NextFloat(0, (float)Math.PI * 2);
                var phi   = r.rand.NextFloat(0, (float)Math.PI * 2);
                var p     = new Vector3(
                    (float)(Math.Sin(phi) * Math.Cos(theta)),
                    (float)(Math.Sin(phi) * Math.Sin(theta)),
                    (float)(Math.Cos(phi))
                    );
                var directional = (p * dist);

                Position = directional + r.cameraPos;
                Visible  = r.field.Zone.Shape.ContainsPoint(Position) &&
                           (r.GetExclusionZone(Position) == null);
                Size    = r.rand.NextFloat(r.field.BillboardSize.X, r.field.BillboardSize.Y) * 2;
                Texture = r.rand.Next(0, 3);
            }