Exemplo n.º 1
0
    private void spawnAtRandomPositions()
    {
        SetPosition(grid.GetUnoccupiedRandomCell());

        //spawn entities
        entityGenerator.Generate(entityGenerator.initialNoOfEntities, entityGenerator.initialWallPercent, entityGenerator.initialTrapPercent, entityGenerator.initialEnemyPercent);
    }
        public void GenerateCube()
        {
            if (modeManager.Mode != GameMode.Editor)
            {
                return;
            }

            entityGenerator.Generate(EntityType.Cube);
            uiManager.Save();
        }
Exemplo n.º 3
0
        public static int Run(string[] args)
        {
            var sw = Stopwatch.StartNew();

            int loadResult = LoadOptions(args);

            if (loadResult != 0)
            {
                return(loadResult);
            }

            _basePath = AbsolutePath(_options.Source);
            AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;            // Look in the base path for referenced .dll files instead of the startup path

            Console.Write("Scanning for DTO objects in {0}...  ", _basePath);
            var apiControllers   = GetApiControllers(_basePath);
            var controllerModels = new HashSet <Type>(apiControllers.SelectMany(GetModelsFromController));           // return and parameter models
            var allModels        = GetAllModelsToGenerate(controllerModels);

            Console.WriteLine("Found {0}", allModels.Count);

            var targetPath = AbsolutePath(_options.Destination);
            // Invoke all generators and pass the results to the index generator
            var allGeneratedNames = IndexGenerator.Generate(targetPath,
                                                            EntityGenerator.Generate(targetPath, allModels, _options),
                                                            DataServiceGenerator.Generate(apiControllers, controllerModels, targetPath, _options)
                                                            );

            RemoveNonGeneratedFiles(targetPath, allGeneratedNames);

            Console.WriteLine("Done in {0:N3}s", sw.Elapsed.TotalSeconds);
            return(0);
        }
Exemplo n.º 4
0
        protected Response Generate(string scope, string app)
        {
            Response response = new Response();

            try
            {
                EntityGenerator generator = _kernel.Get <EntityGenerator>();

                string compilerVersion = "v4.0";
                if (!string.IsNullOrEmpty(_settings["CompilerVersion"]))
                {
                    compilerVersion = _settings["CompilerVersion"];
                }

                Response genRes = generator.Generate(compilerVersion, _dbDictionary, scope, app);

                response.Append(genRes);
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Error refreshing dictionary {0}:", ex));

                response.Level = StatusLevel.Error;
                response.Messages.Add(ex.Message);
            }

            return(response);
        }
Exemplo n.º 5
0
        public static void PrintJpaEntity(Struct entity, string root, List <Struct> entites, List <string> imports)
        {
            string packageDirectory = Path.Combine(root, JavaConventionHelper.packageConvention(entity.Namespace.Name));
            string entityDirectory  = Path.Combine(packageDirectory, "entities");

            Directory.CreateDirectory(entityDirectory);
            using (StreamWriter writer = new StreamWriter(Path.Combine(entityDirectory, entity.Name + ".java")))
            {
                EntityGenerator javaGen = new EntityGenerator();
                writer.WriteLine(javaGen.Generate(entity, entites, imports));
            }
        }
Exemplo n.º 6
0
    //一轮行动结束
    public void Finish()
    {
        entityGenerator.Generate();

        //更新得分
        ctrlScore.UpdateScore();

        //判输
        if (judgement.JudgeLose())
        {
            //游戏结束
            GameObject.Find("txt_goal").GetComponent <Text>().text = "游戏结束!";
        }
    }
Exemplo n.º 7
0
        private void Generate(string projectName, string applicationname)
        {
            if (_databaseDictionary != null && _databaseDictionary.dataObjects != null)
            {
                EntityGenerator generator = new EntityGenerator(_settings);

                string compilerVersion = "v4.0";
                if (!String.IsNullOrEmpty(_settings["CompilerVersion"]))
                {
                    compilerVersion = _settings["CompilerVersion"];
                }

                generator.Generate(compilerVersion, _databaseDictionary, projectName, applicationname);
            }
        }
        public void Load()
        {
            gameState = JsonUtility.FromJson <GameState> (
                PlayerPrefs.GetString(Key)
                );

            entityManager.Clear();

            foreach (var entity in gameState.entities)
            {
                var e = entityGenerator.Generate(entity.type);

                e.ID = entity.id;

                var t = e.GameObject.transform;

                t.position = new Vector3(
                    entity.positionX,
                    entity.positionY,
                    entity.positionZ
                    );

                t.localScale = new Vector3(
                    entity.scale,
                    entity.scale,
                    entity.scale
                    );

                e.Behaviours.Clear();

                foreach (var behaviour in entity.behaviours)
                {
                    e.Behaviours.Add(behaviourFactory.Create(behaviour.type));
                }
            }

            if (verbose)
            {
                Debug.Log("Scene loaded.");
            }
        }
Exemplo n.º 9
0
        private void Generate(string projectName, string applicationname)
        {
            if (_databaseDictionary != null && _databaseDictionary.dataObjects != null)
              {
            EntityGenerator generator = new EntityGenerator(_settings);

            string compilerVersion = "v4.0";
            if (!String.IsNullOrEmpty(_settings["CompilerVersion"]))
            {
              compilerVersion = _settings["CompilerVersion"];
            }

            generator.Generate(compilerVersion, _databaseDictionary, projectName, applicationname);
              }
        }
Exemplo n.º 10
0
        private static SyntaxNode GenerateEntity(
            Language language,
            Solution solution,
            Compilation compilation,
            IImmutableList<INamedTypeSymbol> interfaceSymbols,
            Func<INamedTypeSymbol, string> entityNamespaceSelector,
            Func<INamedTypeSymbol, string> entityNameSelector,
            Func<INamedTypeSymbol, Accessibility> entityAccessibilitySelector,
            INamedTypeSymbol interfaceSymbol)
        {
            var syntaxGenerator = SyntaxGenerator.GetGenerator(solution.Workspace, language.ToSyntaxGeneratorLanguageName());
            var generator = new EntityGenerator(
                language,
                syntaxGenerator,
                solution,
                compilation,
                interfaceSymbols,
                entityNamespaceSelector,
                entityNameSelector,
                entityAccessibilitySelector,
                interfaceSymbol);

            return generator
                .Generate()
                .NormalizeWhitespace();
        }