public override void OnInspectorGUI() { TraitContainer traitContainer = (TraitContainer)target; base.OnInspectorGUI(); TraitManager traitManager = TraitManager.GetInstantiate(); List <Trait> allTraits = traitManager.GetTraits(); GUILayout.Space(10); EditorGUILayout.PropertyField(serializedObject.FindProperty("isHidden")); if (traitContainer.isHidden) { List <string> options = new List <string>(); options.Add("NULL"); foreach (Trait t in allTraits) { options.Add(t.traitName); } int index = EditorGUILayout.Popup(allTraits.IndexOf(traitContainer.mimicryTrait) + 1, options.ToArray()); if (index == 0) { traitContainer.mimicryTrait = null; } else { traitContainer.mimicryTrait = allTraits[index - 1]; } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { Trait trait = (Trait)target; TraitManager traitManager = TraitManager.GetInstantiate(); List <Trait> allTraits = traitManager.GetTraits(); GUIStyle boldStyle = new GUIStyle(); boldStyle.fontStyle = FontStyle.Bold; if (!allTraits.Contains(trait)) { if (PrefabUtility.GetPrefabType(trait) == PrefabType.Prefab) { if (GUILayout.Button("!!! Registrate !!!")) { traitManager.Registrate(trait); } } else { EditorGUILayout.LabelField("---Обратитесь к префабу для регистрации в Game!---"); } GUILayout.Space(10); } base.OnInspectorGUI(); if (trait.type == TraitType.REMOVABLE) { EditorGUILayout.PropertyField(serializedObject.FindProperty("removePoint")); } else if (trait.type == TraitType.TEMPORARY) { EditorGUILayout.PropertyField(serializedObject.FindProperty("liveTime")); } serializedObject.ApplyModifiedProperties(); }
public static TraitManager GetInstantiate() { if (instance == null) { instance = FindObjectOfType <TraitManager>(); } if (instance == null) { Game game = Game.GetInstantiate(); instance = Instantiate(game.traitManager, game.transform); } return(instance); }
private void Awake() { GetInstantiate(); DontDestroyOnLoad(instance); ControlManager.GetInstantiate(); DetectiveManager.GetInstantiate(); TraitManager.GetInstantiate(); ItemManager.GetInstantiate(); QuestManager.GetInstantiate(); MapManager.GetInstantiate(); DialogManager.GetInstantiate(); Agency.GetInstantiate(); }