Exemplo n.º 1
0
        /// <summary>
        /// GameObjectの作成を行う(既に存在する場合は取得)
        /// </summary>
        public static IEnumerable <GameObject> BuildGameObjects(ScriptDependency dependency)
        {
            foreach (var data in dependency.DataList)
            {
                // Debug.LogFormat("GameObjectNameSuffix = {0}", data.GameObjectNameSuffix);
                var gameObject = GameObject.Find(data.RawGameObjectName);
                if (gameObject == null)
                {
                    gameObject = new GameObject(data.RawGameObjectName);
                }
                gameObject.transform.SetSiblingIndex(0);

                yield return(gameObject);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// シーン内のスクリプト作成を行う
        /// </summary>
        public static IEnumerable <MonoScriptData> BuildScripts(string folderPath, string folderName, ScriptDependency dependency)
        {
            var datas = dependency.DataList
                        .SelectMany(data => data.ComponentDataList);

            var classNameList = new List <string>();

            foreach (var data in datas)
            {
                NamePostprocessor.Initialize(folderName); // 設定

                var className = data.RawComponentName;
                className = NamePostprocessor.Rename(className); // リネーム
                className = NameCorrector.CorrectNameIfInvalid(className);

                if (classNameList.Contains(className))
                {
                    Debug.LogErrorFormat("クラス名重複 : className = {0}", className);
                    continue;
                }
                classNameList.Add(className);

                var templateName = data.TemplateName;
                var scriptName   = string.Format("{0}.cs", className);
                var script       = CreateScriptAsset(folderPath, folderName, scriptName, templateName);

                yield return(new MonoScriptData
                {
                    Script = script,
                    RawComponentName = data.RawComponentName
                });
            }
        }