Ejemplo n.º 1
0
        public Vector2 Sample()
        {
            var r   = Radius * (float)Math.Sqrt(RngGenerator.GetFloat());
            var phi = MathHelper.TwoPi * RngGenerator.GetFloat();

            return(Position + new Vector2(r * (float)Math.Cos(phi), r * (float)Math.Sin(phi)));
        }
Ejemplo n.º 2
0
        public void DealDamage(float damage)
        {
            Health -= damage;
            var pixelcount = Health * _damagePixelsMax / 100f;

            // make next pixel black
            while (pixelcount < _damagePixels.Count && pixelcount >= 0)
            {
                var colors = new Color[_damageTexture.Width * _damageTexture.Height];
                _damageTexture.GetData <Color>(colors);

                var pixeltoremove = RngGenerator.GetUInt32() % _damagePixels.Count;
                var pixel         = _damagePixels[(int)pixeltoremove];
                colors[(int)(_damageTexture.Width * pixel.Y + pixel.X)] = Color.Black;
                _damagePixels.RemoveAt((int)pixeltoremove);

                _damageTexture.SetData <Color>(colors);
            }
        }
Ejemplo n.º 3
0
 public EnemyKnight() : this(RngGenerator.GetBool())
 {
 }
Ejemplo n.º 4
0
 public Tower() : this((int)(RngGenerator.GetUInt32() % 4) + 1)
 {
     Health = 100f;
 }