public void CreateAdam() { var bot = BotFactory.Get(Width / 2, Height / 2); bot.Health = Bot.MaxHealth + 1; bot.Direction = Direction.Random(); bot.Color.Reset(); Matrix[bot.X, bot.Y] = bot; }
public readonly Bot[,] Matrix; //Матрица мира public void LoadWorld(WorldInfo worldInfo, IEnumerable <WorldChunk> worldChunks) { Clear(); Width = worldInfo.Width; Height = worldInfo.Height; Iteration = worldInfo.Iteration; foreach (var worldChunk in worldChunks) { foreach (var botDto in worldChunk.Bots) { var bot = BotFactory.Get(botDto.X, botDto.Y); bot.Load(botDto); Matrix[bot.X, bot.Y] = bot; } } }
public void AddRandomBot() { var x = Utils.Next(Width); var y = Utils.Next(Height); var bot = Matrix[x, y]; if (bot == null) { bot = BotFactory.Get(x, y); Matrix[bot.X, bot.Y] = bot; } bot.Reset(); bot.Health = Bot.MaxHealth + 1; for (int i = 0; i < Consciousness.Size; i++) { bot.Consciousness.Mutate(); } }