예제 #1
0
 void OnEnable()
 {
     stamp           = new GameObject("Stamp");
     stamp.hideFlags = HideFlags.HideAndDontSave;
     ip = target as InstancePainter;
     if (ip.SelectedPrefab != null)
     {
         CreateNewStamp();
     }
 }
 void RefreshPaletteImages(InstancePainter ip)
 {
     if (palleteImages == null || palleteImages.Length != ip.prefabPallete.Length)
     {
         palleteImages = new Texture2D[ip.prefabPallete.Length];
         for (var i = 0; i < ip.prefabPallete.Length; i++)
         {
             palleteImages[i] = AssetPreview.GetAssetPreview(ip.prefabPallete[i]);
         }
     }
 }
예제 #3
0
        public override GameObject Generate(InstancePainter instancePainter, GameObject newStamp)
        {
            base.Generate(instancePainter, newStamp);
            // todo: repeat for each floor, 2x2
            // each cell is 4x4
            size.x = ip.brushRadius / 4;
            size.z = ip.brushRadius / 4;
            cells  = new BaseCell[size.x, size.z];
            List <BaseCell> activeCells = new List <BaseCell>();
            IntVector2      coordinates = RandomCoordinates;

            // do the first generation step so we have something to iterate from
            PerformFirstGenerationStep(activeCells);
            while (activeCells.Count > 0)
            {
                PerformNextGenerationStep(activeCells);
            }
            return(stamp);
        }
예제 #4
0
        static GameObject RunGrowingTree(InstancePainter ip, GameObject stamp)
        {
            GrowingTree growingTree = ScriptableObject.CreateInstance <GrowingTree>();

            return(growingTree.Generate(ip, stamp));
        }
예제 #5
0
        static GameObject RunTest(InstancePainter ip, GameObject stamp)
        {
            GeneratorAlgorithm test = ScriptableObject.CreateInstance <GeneratorAlgorithm>();

            return(test.Generate(ip, stamp));
        }