private void AddRandomLogoStar(bool randomStartLife = false) { var pointClickerStar = new PointClickerStar { Pos = new Vector2(Utils.randm(1f), Utils.randm(1f)), life = randomStartLife ? Utils.randm(1f) : 1f, rot = Utils.randm(6.48f), scale = 0.2f + Utils.rand(1.3f), timescale = 0.3f + Utils.randm(1.35f) }; pointClickerStar.color = Utils.AddativeWhite; var num = Utils.randm(1f); var maxValue = 80; if (num < 0.300000011920929) { pointClickerStar.color.R = (byte)(byte.MaxValue - Utils.random.Next(maxValue)); } else if (num < 0.600000023841858) { pointClickerStar.color.G = (byte)(byte.MaxValue - Utils.random.Next(maxValue)); } else if (num < 0.899999976158142) { pointClickerStar.color.B = (byte)(byte.MaxValue - Utils.random.Next(maxValue)); } Stars.Add(pointClickerStar); }
private void DrawStar(Rectangle logoDest, SpriteBatch sb, PointClickerStar star) { var position = new Vector2((float)(star.Pos.X * (double)logoDest.Width * 0.5) + logoDest.X, (float)(star.Pos.Y * (double)logoDest.Height * 0.5) + logoDest.Y); position.X += logoDest.Width * 0.25f; position.Y += logoDest.Height * 0.25f; var num1 = star.life >= 0.899999976158142 ? (float)(1.0 - (star.life - 0.899999976158142) / 0.100000001490116) : (float)((star.life - 0.100000001490116) / 0.899999976158142); var num2 = Vector2.Distance(star.Pos, new Vector2(0.5f)); var num3 = 0.9f; if (num2 > (double)num3) { num1 = (float)(1.0 - (num2 - (double)num3) / 1.0) * num1; } sb.Draw(logoStar, position, new Rectangle?(), star.color * num1, star.rot * (star.life * 0.5f), new Vector2(logoStar.Width / 2, logoStar.Height / 2), star.scale * num1, SpriteEffects.None, 0.4f); }
private void DrawStar(Rectangle logoDest, SpriteBatch sb, PointClickerStar star) { var position = new Vector2((float) (star.Pos.X*(double) logoDest.Width*0.5) + logoDest.X, (float) (star.Pos.Y*(double) logoDest.Height*0.5) + logoDest.Y); position.X += logoDest.Width*0.25f; position.Y += logoDest.Height*0.25f; var num1 = star.life >= 0.899999976158142 ? (float) (1.0 - (star.life - 0.899999976158142)/0.100000001490116) : (float) ((star.life - 0.100000001490116)/0.899999976158142); var num2 = Vector2.Distance(star.Pos, new Vector2(0.5f)); var num3 = 0.9f; if (num2 > (double) num3) num1 = (float) (1.0 - (num2 - (double) num3)/1.0)*num1; sb.Draw(logoStar, position, new Rectangle?(), star.color*num1, star.rot*(star.life*0.5f), new Vector2(logoStar.Width/2, logoStar.Height/2), star.scale*num1, SpriteEffects.None, 0.4f); }
private void AddRandomLogoStar(bool randomStartLife = false) { var pointClickerStar = new PointClickerStar { Pos = new Vector2(Utils.randm(1f), Utils.randm(1f)), life = randomStartLife ? Utils.randm(1f) : 1f, rot = Utils.randm(6.48f), scale = 0.2f + Utils.rand(1.3f), timescale = 0.3f + Utils.randm(1.35f) }; pointClickerStar.color = Utils.AddativeWhite; var num = Utils.randm(1f); var maxValue = 80; if (num < 0.300000011920929) pointClickerStar.color.R = (byte) (byte.MaxValue - Utils.random.Next(maxValue)); else if (num < 0.600000023841858) pointClickerStar.color.G = (byte) (byte.MaxValue - Utils.random.Next(maxValue)); else if (num < 0.899999976158142) pointClickerStar.color.B = (byte) (byte.MaxValue - Utils.random.Next(maxValue)); Stars.Add(pointClickerStar); }