Exemple #1
0
        public ISimulation GenererJeux(ISimulationReader reader)
        {
            var partMaker  = reader.FabriqueSimulation();
            var simulation = partMaker.CreerSimulation(reader.GetElements().First().arguments);

            fabriqueAcces      = partMaker.CreerFabriqueAcces(simulation);
            fabriqueZone       = partMaker.CreerFabriqueZone(simulation);
            fabriquePersonnage = partMaker.CreerFabriquePersonnage(simulation);
            fabriquePlateau    = partMaker.CreerPlateauFactory(simulation);

            simulation.Plateau = fabriquePlateau.CreerPlateau();
            foreach (var readed in reader.GetElements().Skip(1))
            {
                switch (readed.ObjectType)
                {
                case ESimulationObjectType.Personnage:
                    AjouterPersonnage(simulation.Plateau, readed);
                    break;

                case ESimulationObjectType.Zone:
                    AjouterZone(simulation.Plateau, readed);
                    break;

                case ESimulationObjectType.Acces:
                    AjouterAcces(simulation.Plateau, readed);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            return(simulation);
        }
        public ISimulation GenererJeux(ISimulationReader reader)
        {
            var partMaker = reader.FabriqueSimulation();
            var simulation = partMaker.CreerSimulation(reader.GetElements().First().arguments);

            fabriqueAcces = partMaker.CreerFabriqueAcces(simulation);
            fabriqueZone = partMaker.CreerFabriqueZone(simulation);
            fabriquePersonnage = partMaker.CreerFabriquePersonnage(simulation);
            fabriquePlateau = partMaker.CreerPlateauFactory(simulation);

            simulation.Plateau = fabriquePlateau.CreerPlateau();
            foreach (var readed in reader.GetElements().Skip(1))
            {
                switch (readed.ObjectType)
                {
                    case ESimulationObjectType.Personnage:
                        AjouterPersonnage(simulation.Plateau, readed);
                        break;
                    case ESimulationObjectType.Zone:
                        AjouterZone(simulation.Plateau, readed);
                        break;
                    case ESimulationObjectType.Acces:
                        AjouterAcces(simulation.Plateau, readed);
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
            }
            return simulation;
        }