たとえば、私は現在ゲームに取り組んでおり、リスト内のすべての Projectile ではなく、最後の Projectile をどのように取り除くのでしょうか。これが私のショットコードです。
if (mouse.RightButton == ButtonState.Pressed)
{
if (Plist.Count < 100)
{
Plist.Add(p);
f = 0;
p.Position = gamePlayer.Position;
}
p.Target = new Vector2(mouse.X + gameCamera.Position.X, mouse.Y + gameCamera.Position.Y) + randomv;
}
foreach (Projectile po in Plist)
{
if (Vector2.Distance(po.Position, po.Target) < 10)
{
p.Remove = true;
}
}
if (p.Remove == true)
{
for (int i = 0; i < Plist.Count; i++)
{
Plist.RemoveAt(i);
}
p.Remove = false;
}