Example #1
0
        public static TerrainCutter20193 CreateInstance(DiggerSystem digger)
        {
            var cutter = digger.gameObject.AddComponent <TerrainCutter20193>();

            cutter.digger = digger;
            cutter.Refresh();
            return(cutter);
        }
Example #2
0
        public static TerrainCutter Create(Terrain terrain, DiggerSystem digger)
        {
#if UNITY_2019_3_OR_NEWER
            return(TerrainCutter20193.CreateInstance(digger));
#else
            return(TerrainCutterLegacy.CreateInstance(terrain, digger));
#endif
        }
Example #3
0
        public static TerrainCutterLegacy CreateInstance(Terrain terrain, DiggerSystem digger)
        {
            var cutter = digger.gameObject.AddComponent <TerrainCutterLegacy>();

            cutter.digger = digger;

#if UNITY_EDITOR
            var transparencyMapPath = digger.GetTransparencyMapPath();
            cutter.transparencyMap = AssetDatabase.LoadAssetAtPath <Texture2D>(transparencyMapPath);
#endif
            if (cutter.transparencyMap == null)
            {
                cutter.transparencyMap = cutter.CreateNewTransparencyMap();
            }

            cutter.Refresh();
            cutter.Apply(true);
            return(cutter);
        }