Car/Assets/Scripts/GameConfig.cs

28 lines
1.0 KiB
C#

using System.Collections.Generic;
[System.Serializable]
public class GameConfig
{
public List<CarConfig> Cars = new List<CarConfig>();
}
class ExampleGame
{
private void Main()
{
var gameConfig = new GameConfig();
var carConfig = new CarConfig();
var componentConfig1 = new CarComponentConfig() { = "前保险杠" };
var componentConfig2 = new CarComponentConfig() { = "大灯" };
var componentConfig3 = new CarComponentConfig() { = "尾灯" };
var component1 = new ComponentConfig() { = "TO2018" };
var component2 = new ComponentConfig() { = "TO2024" };
componentConfig1..Add(component1);
componentConfig1..Add(component2);
carConfig..Add(componentConfig1);
carConfig..Add(componentConfig2);
carConfig..Add(componentConfig3);
gameConfig.Cars.Add(carConfig);
}
}