void Awake() { instance = this; if (mode == TrainMode.Internal) { env = new InternalEnv(); } else { env = new ExternalEnv(); } tickTime = 15 * Time.deltaTime; env.Init(); }
public void FillEnv() { int num = System.Enum.GetValues(typeof(TrainMode)).Length; if (envs == null || envs.Length != num) { envs = new ScriptableObject[num]; foreach (TrainMode mode in System.Enum.GetValues(typeof(TrainMode))) { envs[(int)mode] = ScriptableObject.CreateInstance(mode.ToString() + "Env"); } } env = (BaseEnv)envs[(int)mode]; }