private void Awake()
        {
            if (instance != null && instance != this)
            {
                Destroy(gameObject);
                return;
            }

            instance = this;
        }
Exemple #2
0
        private void Awake()
        {
            if (instance != null && instance != this)
            {
                Destroy(gameObject);
                return;
            }

            instance = this;

            Roots = new Transform[(int)ANIMAL_TYPE.COUNT];
            for (int i = 0; i < (int)ANIMAL_TYPE.COUNT; ++i)
            {
                var go = new GameObject();
                Roots[i]        = go.transform;
                Roots[i].parent = transform;
                Roots[i].name   = ROOT_NAMES[i];
            }
        }
        public override void OnInspectorGUI()
        {
            AnimalManager animalManager = (AnimalManager)target;

            if (!Application.isPlaying)
            {
                base.OnInspectorGUI();
                return;
            }

            GUILayout.Space(10);

            animalManager.PeaceTime = EditorGUILayout.Toggle("Peace Time", animalManager.PeaceTime);

            GUILayout.Space(5);

            if (GUILayout.Button("Nuke Animals"))
            {
                animalManager.Nuke();
            }
        }