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();
        }
Beispiel #2
0
        public void AddTrait(Trait trait)
        {
            GameObject goTrait = new GameObject(trait.name);

            goTrait.transform.parent = GetTraitFolder().transform;
            TraitContainer traitContainer = goTrait.AddComponent <TraitContainer>();

            traitContainer.trait = trait;
        }
Beispiel #3
0
 public void AttachEffects(Detective owner)
 {
     foreach (TraitEffect effect in traitEffects)
     {
         if (effect.type == TraitEffectType.CHANGE_BRUTAL)
         {
             owner.ChangeMethodValue(Method.Brutal, effect.value);
         }
         else if (effect.type == TraitEffectType.CHANGE_CAREFUL)
         {
             owner.ChangeMethodValue(Method.Accuracy, effect.value);
         }
         else if (effect.type == TraitEffectType.CHANGE_DIPLOMATIC)
         {
             owner.ChangeMethodValue(Method.Diplomacy, effect.value);
         }
         else if (effect.type == TraitEffectType.CHANGE_SCIENTIFIC)
         {
             owner.ChangeMethodValue(Method.Science, effect.value);
         }
         if (effect.type == TraitEffectType.CHANGE_MAX_BRUTAL)
         {
             owner.ChangeMaxMethodValue(Method.Brutal, effect.value);
         }
         else if (effect.type == TraitEffectType.CHANGE_MAX_CAREFUL)
         {
             owner.ChangeMaxMethodValue(Method.Accuracy, effect.value);
         }
         else if (effect.type == TraitEffectType.CHANGE_MAX_DIPLOMATIC)
         {
             owner.ChangeMaxMethodValue(Method.Diplomacy, effect.value);
         }
         else if (effect.type == TraitEffectType.CHANGE_MAX_SCIENTIFIC)
         {
             owner.ChangeMaxMethodValue(Method.Science, effect.value);
         }
         else if (effect.type == TraitEffectType.CHANGE_MAX_HEALTH)
         {
             owner.ChangeMaxHealth(effect.value);
         }
         else if (effect.type == TraitEffectType.CHANGE_MIN_STRESS)
         {
             owner.ChangeMinStress(effect.value);
         }
         else if (effect.type == TraitEffectType.DETACH_TRAIT)
         {
             TraitContainer container = owner.GetTrait(effect.trait);
             if (container != null)
             {
                 container.isDettached = true;
                 container.DetachEffects();
             }
         }
         else if (effect.type == TraitEffectType.CHANGE_SPEED_MOD)
         {
             owner.speedMod *= effect.floatValue;
         }
         else if (effect.type == TraitEffectType.CHANGE_BLOCKED_EQUIPMENT_SLOT)
         {
             owner.ChangeBlockedSlot(effect.value);
         }
         else if (effect.type == TraitEffectType.CHANGE_MAX_ITEM_SLOT)
         {
             owner.ChangeMaxItemSlot(effect.value);
         }
     }
 }