public void GenerateStep()
        {
#if UNITY_EDITOR
            UnityEditor.Undo.RecordObject(this.gameObject, "Generation Step");
            UnityEditor.Undo.RecordObject(this, "Generation Step");
            UnityEditor.Undo.RecordObject(patternView, "Generation Step");
            UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this.gameObject);
            UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this);
            UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(patternView);
#endif
            // we execute until we have visible change
            for (int i = 0; i < 100; i++)
            {
                GenerationStepResult result = GenerationStepInternal();
                if (result == GenerationStepResult.EndOfFile)
                {
                    return;
                }
                if (result == GenerationStepResult.VisibleChange)
                {
                    break;
                }
            }
            PatternView.UpdateView();
        }
        public void InitializeGeneration()
        {
#if UNITY_EDITOR
            UnityEditor.Undo.RecordObject(this.gameObject, "Intialize Generation");
            UnityEditor.Undo.RecordObject(this, "Intialize Generation");
            UnityEditor.Undo.RecordObject(patternView, "Intialize Generation");
            UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this.gameObject);
            UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this);
            UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(patternView);
#endif
            if (increaseSeed)
            {
                seed++;
            }

            patternView.pattern = new Pattern(startSize, Tile.Empty);
            ReplacementEngine re = GetComponent <ReplacementEngine>();
            re.ResetGeneration(seed);
            PatternView.UpdateView();

            ParseInstructions();
            currentInstruction = 0;
            applicationCounter = 0;
            gotoStack          = new Stack <ProgramState>();
        }
Ejemplo n.º 3
0
        public void GenerateStep()
        {
#if UNITY_EDITOR
            UnityEditor.Undo.RecordObject(this.gameObject, "Generation Step");
            UnityEditor.Undo.RecordObject(this, "Generation Step");
            UnityEditor.Undo.RecordObject(patternView, "Generation Step");
            UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this.gameObject);
            UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this);
            UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(patternView);
#endif

            ReplacementEngine re = GetComponent <ReplacementEngine>();
            re.ReplaceMatch();
            PatternView.UpdateView();
        }