我正在制作一个垂直平台游戏。我放置平台的方式是通过列表:
public void LoadPlatforms(ContentManager content, Mechanic_Levels mech, Clide clide)
{
platforms.Add(new Entity_Platform());
platforms.Add(new Entity_Platform());
platforms.Add(new Entity_Platform());
platforms.Add(new Entity_Platform());
platforms.Add(new Entity_Platform());
platforms.Add(new Entity_Platform());
platforms.Add(new Entity_Platform());
platforms.Add(new Entity_Platform());
platforms.Add(new Entity_Platform());
// factory.Add(new Entity_Factory());
foreach (Entity_Platform platform in platforms)
{
platform.position = new Vector2(rand.Next(20, 280), rand.Next(20, 580));
platform.currentlevel = rand.Next(12);
platform.LoadPlatform(content);
}
}
这适用于如果我想随机放置平台但我将如何设置它以便根据当前级别平台单独重新定位自己?我知道这可能意味着我不能使用列表。