Пример #1
0
        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();
        }
Пример #2
0
 internal WorldView(WorldMap world)
 {
     m_world = world;
 }
Пример #3
0
 public DefaultEvolveControler(WorldMap world, int startDelay, int interval) : base(startDelay, interval)
 {
     m_world = world;
 }
Пример #4
0
 public DefaultEvolveControler(WorldMap world) : base(DEFAULT_START_DELAY, DEFAULT_INTERVAL)
 {
     m_world = world;
 }