public float Compare(FireWork f) { var t = 1f - Math.Abs(f.Time - Time); var d = Vector2.Distance(Location, f.Location); d = 1f - Math.Min(d, 200f) / 200f; //0-1 var rd = 1f - Math.Abs(f.Color.R - Color.R) / 255f; var gd = 1f - Math.Abs(f.Color.G - Color.G) / 255f; var bd = 1f - Math.Abs(f.Color.B - Color.B) / 255f; var ca = (rd + gd + bd) / 3f; var sd = 1f - Math.Abs(Size - f.Size); return((d * .5f) + (sd * .1f) + (t * .3f) + (ca * .1f)); }
private void AddFireWorks(Vector2 point, Color color, float size) { if (CurrentMap.Events.Count <= RecordEvents.Count) { return; } Game.AddFireWorks(point, color, size); var f = new FireWork(point, color, size, CurrentMap.Complete); var s = f.Compare(CurrentMap.Events[RecordEvents.Count]); ScoreParticles.Add(new MiniScore { Score = MiniScore.GetMiniScoreFor(s), Location = point, Fade = new Tween(new TimeSpan(0, 0, 0, 1), 1, 0) }); RecordEvents.Add(f); Score += MiniScore.GetScoreFor(MiniScore.GetMiniScoreFor(s)); }