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))); }
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); } }
public EnemyKnight() : this(RngGenerator.GetBool()) { }
public Tower() : this((int)(RngGenerator.GetUInt32() % 4) + 1) { Health = 100f; }