public void CreateMap() { CurrectSelectorTween.Reset(); CurrentFireWork = new RushFireWork(FireWorkArea.RandomPoint(), CreateColor(Splosion.Random.NextFloat()), Math.Max(.80f + (Splosion.Random.NextFloat() * .2f), 1f)); Game.AddFireWorks(CurrentFireWork.Location, CurrentFireWork.Color, CurrentFireWork.Size); }
private void AddFireWorks(Vector2 point, Color color, float size) { Game.AddFireWorks(point, color, size); var f = new RushFireWork(point, color, size); var s = f.Compare(CurrentFireWork); var ms = MiniScore.GetMiniScoreFor(s); int sc = MiniScore.GetScoreFor(ms); ScoreParticles.Add(new MiniScore { Score = ms, Location = point, Fade = new Tween(new TimeSpan(0, 0, 0, 1), 1, 0) }); if (sc == MiniScore.GetScoreFor(MiniScores.PERFECT)) { Multiplier++; if (Multiplier > 3) { Multiplier = 3; } MultiplierTween.Reset(); } Score += sc * (Multiplier + 1); var pTime = new TimeSpan(MiniScore.GetTimeFor(MiniScore.GetMiniScoreFor(s)).Ticks *(Multiplier + 1)); if (pTime > TimeSpan.Zero) { TimeParticles.Add(new TimeParticle { Time = float.Parse(pTime.Seconds + ((pTime.Milliseconds > 0)?"." + pTime.Milliseconds:"")), Location = point, Fade = new Tween(new TimeSpan(0, 0, 0, 6), 1, 0) }); } TTL += pTime; if (TTL > CurrentTTL) { if (TTL > MaxTTL) { TTL = MaxTTL; CurrentTTL = TTL; } else { CurrentTTL = TTL; } } RSG = PlayState.ADD; }
public float Compare(RushFireWork f) { 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 * .2f) + (ca * .3f)); }