Ejemplo n.º 1
0
 /// <summary>
 /// This method is used to change World Variable values during damage or destruction. This can be overridden in a subclass to do other things.
 /// </summary>
 /// <param name="modCollection">The collection of World Variable modifications.</param>
 /// <param name="isDamage">True if from damage, false otherwise.</param>
 public virtual void ModifyWorldVariables(WorldVariableCollection modCollection, bool isDamage)
 {
     if (modCollection.statMods.Count > 0 && listener != null) {
         if (isDamage) {
             listener.ModifyingDamageWorldVariables(modCollection.statMods);
         } else {
             listener.ModifyingDeathWorldVariables(modCollection.statMods);
         }
     }
     foreach (var modifier in modCollection.statMods) {
         WorldVariableTracker.ModifyPlayerStat(modifier, Trans);
     }
 }
    private void AddStatModifier(string modifierName, WorldVariableCollection modifiers) {
        if (modifiers.HasKey(modifierName)) {
            DTInspectorUtility.ShowAlert("This Killable already has a modifier for World Variable: " + modifierName + ". Please modify that instead.");
            return;
        }

        UndoHelper.RecordObjectPropertyForUndo(ref _isDirty, _kill, "add Modifier");

        var myVar = WorldVariableTracker.GetWorldVariableScript(modifierName);

        modifiers.statMods.Add(new WorldVariableModifier(modifierName, myVar.varType));
    }