public static Projectile Create(int FrameCount, float xPos, float yPos, float xVel, float yVel, Action <Creep> hitCreepDelegate) { Projectile P = null; if (ProjectilePool.Count > 0) { P = ProjectilePool.Dequeue(); if (P.RelFrame == Arena.instance.Frame) { ProjectilePool.Enqueue(P); P = new Projectile(); } } else { P = new Projectile(); } P.XPos = xPos; P.YPos = yPos; P.XVel = xVel / 4; P.YVel = yVel / 4; P.HitCreepDelegate = hitCreepDelegate; //P.Speed = speed; //P.Flight = 1000 / P.Speed; //P.ImpactDamage = 0; P.AquiredFrame = FrameCount; double F = 1000; if (P.XVel > 0) { F = Math.Min(F, (909 - P.XPos) / P.XVel); } else if (P.XVel < 0) { F = Math.Min(F, (P.XPos) / -P.XVel); } if (P.YVel > 0) { F = Math.Min(F, (707 - P.YPos) / P.YVel); } else if (P.YVel < 0) { F = Math.Min(F, (P.YPos) / -P.YVel); } P.Flight = F; Added.Enqueue(P); //P.Visibility = Visibility.Visible; return(P); }