Ejemplo n.º 1
0
 public void RemoveBonus(string id, Tapestry_BonusType type)
 {
     if (type == Tapestry_BonusType.AddsToBase)
     {
         if (bonusTypeBase.ContainsKey(id))
         {
             bonusTypeBase.Remove(id);
         }
     }
     else if (type == Tapestry_BonusType.AdditiveBonus)
     {
         if (bonusTypeAdditive.ContainsKey(id))
         {
             bonusTypeAdditive.Remove(id);
         }
     }
     else if (type == Tapestry_BonusType.MultiplicativeBonus)
     {
         if (bonusTypeMultiplicative.ContainsKey(id))
         {
             bonusTypeMultiplicative.Remove(id);
         }
     }
     Recalculate();
 }
 public Tapestry_EffectBuilder_Payload_ModifyJump()
 {
     amount               = 0.10f;
     id                   = "Generic";
     type                 = Tapestry_BonusType.AdditiveBonus;
     overwrite            = false;
     overwriteByMag       = true;
     removeWhenEffectEnds = true;
 }
    public override void DrawInspector()
    {
        GUILayout.BeginVertical("box");

        GUILayout.BeginHorizontal();
        GUILayout.Space(40);
        GUILayout.Label("Amount");
        amount = EditorGUILayout.DelayedFloatField(amount, GUILayout.Width(42));
        GUILayout.FlexibleSpace();
        GUILayout.Label("ID");
        id = EditorGUILayout.DelayedTextField(id, GUILayout.Width(60));
        GUILayout.FlexibleSpace();
        GUILayout.Label("Type");
        type = (Tapestry_BonusType)EditorGUILayout.EnumPopup(type, GUILayout.Width(100));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(40);
        overwrite = EditorGUILayout.Toggle(overwrite, GUILayout.Width(12));
        GUILayout.Label("Overwrite Same ID?");
        GUILayout.FlexibleSpace();
        if (overwrite)
        {
            overwriteByMag = EditorGUILayout.Toggle(overwriteByMag, GUILayout.Width(12));
            GUILayout.Label("Only if magnitude is greater?");
            GUILayout.FlexibleSpace();
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(40);
        removeWhenEffectEnds = EditorGUILayout.Toggle(removeWhenEffectEnds, GUILayout.Width(12));
        GUILayout.Label("Remove when Effect ends?");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();
    }
Ejemplo n.º 4
0
 public void AddBonus(float bonus, string ID, Tapestry_BonusType type, bool overwriteConflictingID = false, bool onlyOverwriteLowerMagnitude = false)
 {
     if (type == Tapestry_BonusType.AddsToBase)
     {
         if (overwriteConflictingID)
         {
             if (onlyOverwriteLowerMagnitude)
             {
                 if (bonusTypeBase.ContainsKey(ID))
                 {
                     if (Mathf.Abs(bonus) > Mathf.Abs(bonusTypeBase[ID]))
                     {
                         bonusTypeBase[ID] = bonus;
                     }
                 }
             }
             else
             {
                 bonusTypeBase[ID] = bonus;
             }
         }
         else
         {
             if (!bonusTypeBase.ContainsKey(ID))
             {
                 bonusTypeBase.Add(ID, bonus);
             }
         }
     }
     else if (type == Tapestry_BonusType.AdditiveBonus)
     {
         if (overwriteConflictingID)
         {
             if (onlyOverwriteLowerMagnitude)
             {
                 if (bonusTypeAdditive.ContainsKey(ID))
                 {
                     if (Mathf.Abs(bonus) > Mathf.Abs(bonusTypeAdditive[ID]))
                     {
                         bonusTypeAdditive[ID] = bonus;
                     }
                 }
             }
             else
             {
                 bonusTypeAdditive[ID] = bonus;
             }
         }
         else
         {
             if (!bonusTypeAdditive.ContainsKey(ID))
             {
                 bonusTypeAdditive.Add(ID, bonus);
             }
         }
     }
     else if (type == Tapestry_BonusType.MultiplicativeBonus)
     {
         if (overwriteConflictingID)
         {
             if (onlyOverwriteLowerMagnitude)
             {
                 if (bonusTypeMultiplicative.ContainsKey(ID))
                 {
                     if (Mathf.Abs(bonus) > Mathf.Abs(bonusTypeMultiplicative[ID]))
                     {
                         bonusTypeMultiplicative[ID] = bonus;
                     }
                 }
             }
             else
             {
                 bonusTypeMultiplicative[ID] = bonus;
             }
         }
         else
         {
             if (!bonusTypeMultiplicative.ContainsKey(ID))
             {
                 bonusTypeMultiplicative.Add(ID, bonus);
             }
         }
     }
     Recalculate();
 }