using System.Collections.Generic; using UnityEditor; using UnityEngine; namespace DestroyIt { public class SetupDestroyIt { [MenuItem("Window/DestroyIt/Setup - Minimal")] public static void SetupMinimalMenuOption() { GameObject destroyIt; DestructionManager destructionManager = Object.FindObjectOfType(); if (destructionManager != null) destroyIt = destructionManager.gameObject; else destroyIt = new GameObject("DestroyIt"); destroyIt.AddComponent(); destroyIt.AddComponent(); ObjectPool pool = destroyIt.AddComponent(); DestructionTest destructionTest = Object.FindObjectOfType(); if (destructionTest == null) { GameObject destroyItTest = new GameObject("DestroyIt-InputTest"); destroyItTest.AddComponent(); } if (pool != null) { GameObject defaultLargeParticle = Resources.Load("Default_Particles/DefaultLargeParticle"); GameObject defaultSmallParticle = Resources.Load("Default_Particles/DefaultSmallParticle"); pool.prefabsToPool = new List(); pool.prefabsToPool.Add(new PoolEntry() {Count = 10, Prefab = defaultLargeParticle}); pool.prefabsToPool.Add(new PoolEntry() {Count = 10, Prefab = defaultSmallParticle}); } } [MenuItem("Window/DestroyIt/Setup - Destructible Trees")] public static void SetupDestructibleTreesMenuOption() { EditorUtility.DisplayDialog("A Note About Destructible Trees", "NOTE: You will need to uncheck Enable Tree Colliders on your terrain in order to use destructible trees.\n\n" + "Once you've added your trees to the terrain, click the \"Update Trees\" button on the TreeManager, and DestroyIt will " + "create game objects with colliders and place them over the terrain tree instances so they can be destroyed.", "Ok"); DestructionManager destructionManager = Object.FindObjectOfType(); if (destructionManager == null) SetupMinimalMenuOption(); destructionManager = Object.FindObjectOfType(); destructionManager.gameObject.AddComponent(); } } }