public static void Delete() { _instance = null; }
private void PostInitialize() { Settings.LoadSettings(); ImageManager.Delete(); PathManager.Delete(); TickDelay = Settings.Instance.GameTickTime; Width = Settings.Instance.Width; Height = Settings.Instance.Height; FuzzyMachine.Initialize(); StateMachine.Initialize(); if (Settings.Instance.RandomSeed != 0) { Random = new Random(Settings.Instance.RandomSeed); } else { Random = new Random(); } Obstacles = new List <BaseObstacle>(); for (int i = 0; i < Settings.Instance.RockCount; i++) { Obstacles.Add(new Rock(new Location(Random.Next((int)Width), Random.Next((int)Height)), 30)); } for (int i = 0; i < Settings.Instance.TreeCount; i++) { Obstacles.Add(new Tree(new Location(Random.Next((int)Width), Random.Next((int)Height)), 30)); } SteeringForceCalculationType = SteeringForceCalculationType.WeightedTruncatedSum; StoneEdge(); Entities = new List <BaseEntity>(); for (int i = 0; i < Settings.Instance.HerbivoreCount; i++) { Entities.Add(new Herbivore { State = Settings.Instance.HerbivoreStartState, Direction = Math.PI * 2 * Random.NextDouble(), Location = new Location(Random.Next(40, (int)Width - 40), Random.Next(40, (int)Height - 40)) }); } for (int i = 0; i < Settings.Instance.OmnivoreCount; i++) { Entities.Add(new Omnivore { State = Settings.Instance.OmnivoreStartState, Direction = Math.PI * 2 * Random.NextDouble(), Location = new Location(Random.Next(40, (int)Width - 40), Random.Next(40, (int)Height - 40)) }); } InitGrids(); NavGraph = new Graph(); watch = new Stopwatch(); watch.Start(); timer = new Timer(); timer.Interval = TickDelay; timer.Tick += new EventHandler(GameTick); timer.Start(); }