Beispiel #1
0
 public float GetEvolutionDNAValue(EvolutionNames.FloatDNA key)
 {
     float energyMax = 0.0f;
     foreach (TraitLeveler trait in traits)
     {
         energyMax += trait.getFloatValue(key);
     }
     return energyMax;
 }
Beispiel #2
0
    public float getFloatValueByKeyAndLevel(EvolutionNames.FloatDNA key, int level)
    {
        if (level < 0)
            level = 0;

        for (int i = 0; i < traitModifiers.Length; ++i)
        {
            FloatTraitModifier mod = traitModifiers[i] as FloatTraitModifier;
            if (mod != null && key == mod.geneName)
            {
                return mod.value;
            }
        }
        return 0.0f;
    }
Beispiel #3
0
    public bool getBoolValueByKeyAndLevel(EvolutionNames.BoolDNA key, int level)
    {
        if (level < 0)
            level = 0;

        for (int i = 0; i < traitModifiers.Length; ++i)
        {
            BoolTraitModifier mod = traitModifiers[i] as BoolTraitModifier;
            if (key == mod.geneName)
            {

                return mod.value;
            }
        }
        return false;
    }
Beispiel #4
0
 public void Nerfing(EvolutionNames.FloatDNA name, float nerf)
 {
     float rs = GetFloatValue (name) - Math.Abs (nerf);
     cached_float_values.Remove (name);
     cached_float_values.Add (name, rs);
 }
Beispiel #5
0
 public void Buffing(EvolutionNames.FloatDNA name, float buff)
 {
     float rs = GetFloatValue (name) + Math.Abs (buff);
     cached_float_values.Remove (name);
     cached_float_values.Add (name, rs);
 }
Beispiel #6
0
 protected float GetFloatValue(EvolutionNames.FloatDNA name)
 {
     float rs = -1.0f;
     if(cached_float_values.ContainsKey(name))
         cached_float_values.TryGetValue (name, out rs);
     return rs;
 }
Beispiel #7
0
 public void AddToValue(EvolutionNames.AgentSelf name, float value)
 {
     SetCurrentValue (name, GetCurrentValue (name) + Mathf.Abs(value));
 }
Beispiel #8
0
 protected float SetCurrentValue(EvolutionNames.AgentSelf name, float val)
 {
     values.Remove (name);
     values.Add (name, val);
     return val;
 }
Beispiel #9
0
 protected float GetCurrentValue(EvolutionNames.AgentSelf name)
 {
     float rs = 0;
     values.TryGetValue (name, out rs);
     return rs;
 }
Beispiel #10
0
 public float GetValue(EvolutionNames.FloatDNA floatDNA)
 {
     float rs = 0;
     rs = alimentation.getFloatValueByKeyAndLevel (floatDNA,0);
     rs += blood.getFloatValueByKeyAndLevel (floatDNA, 0);
     rs += skin.getFloatValueByKeyAndLevel (floatDNA, 0);
     foreach (Trait t in others) {
         rs += t.getFloatValueByKeyAndLevel(floatDNA, 0);
     }
     return rs;
 }