Exemplo n.º 1
0
        public static List <Asteroid> Create(AsteroidHuntMatch match)
        {
            List <Asteroid> asteroids = new List <Asteroid>();

            var createProbability = match.Random.NextDouble();

            if (Constants.Simploid.Probability >= createProbability)
            {
                Asteroid simploid = new Asteroid(match, Constants.Simploid.Color, Constants.Simploid.MinSize, Constants.Simploid.MaxSize,
                                                 Constants.Simploid.MinVelocity, Constants.Simploid.MaxVelocity, Constants.Simploid.MinHitpoints, Constants.Simploid.MaxHitpoints,
                                                 Constants.Simploid.HitpointsPlayerScaling, Constants.Simploid.BaseScore);

                asteroids.Add(simploid);
            }
            if (Constants.Robustoid.Probability >= createProbability)
            {
                Asteroid robustoid = new Asteroid(match, Constants.Robustoid.Color, Constants.Robustoid.MinSize, Constants.Robustoid.MaxSize,
                                                  Constants.Robustoid.MinVelocity, Constants.Robustoid.MaxVelocity, Constants.Robustoid.MinHitpoints, Constants.Robustoid.MaxHitpoints,
                                                  Constants.Robustoid.HitpointsPlayerScaling, Constants.Robustoid.BaseScore);

                asteroids.Add(robustoid);
            }

            return(asteroids);
        }
Exemplo n.º 2
0
 private static int GetPlayerScale(AsteroidHuntMatch match, bool hitpointsPlayerScaling)
 {
     if (hitpointsPlayerScaling)
     {
         return(match.Players.Count);
     }
     else
     {
         return(1);
     }
 }
Exemplo n.º 3
0
        public Asteroid(AsteroidHuntMatch match, Color color, double minSize, double maxSize, double minVelocity, double maxVelocity, int minHitpoints, int maxHitpoints, bool hitpointsPlayerScaling, int baseScore)
        {
            double size       = Choose(match.Random.NextDouble(), Constants.Simploid.MinSize, Constants.Simploid.MaxSize);
            double random     = match.Random.NextDouble();
            double randomPow2 = random * random;
            Vector velocity   = new Vector((randomPow2 - 0.25) * 2, Choose(match.Random.NextDouble(), Constants.Simploid.MinVelocity, Constants.Simploid.MaxVelocity));

            Match     = match;
            Color     = color;
            Size      = size;
            Position  = new Vector(match.Random.NextDouble() * 320, -size / 2d);
            Velocity  = velocity;
            Hitpoints = GetPlayerScale(match, hitpointsPlayerScaling) * Choose(match.Random.NextDouble(), minHitpoints, maxHitpoints);
            Score     = baseScore + (int)Math.Round(velocity.X) + (int)Math.Round(velocity.Y / maxVelocity) + (int)Math.Round(minSize / size);
        }