private void InitWorld() { WorldEditor editor = new WorldEditor(); //设置生命游戏 死亡规则 editor.DeathRules.Add(new DeathRule((unit, args) => { var spaces = args.NearSpaces; int nearLivesCount = 0; foreach (var space in spaces) { if (space.HasLife) { ++nearLivesCount; } } if (nearLivesCount >= 4 || nearLivesCount <= 1) { return(STATUS_DEATH_TRUE); } else { return(STATUS_DEATH_FALSE); } })); //设置生命游戏 复活规则 editor.RebornRules.Add(new RebornRule((unit, args) => { var spaces = args.NearSpaces; int nearLivesCount = 0; foreach (var space in spaces) { if (space.HasLife) { ++nearLivesCount; } } if (nearLivesCount == 3) { return(STATUS_REBORN_TRUE); } else { return(STATUS_REBORN_FALSE); } })); m_world = editor.CreatWorld(); InitWorldSetting(); }