Beispiel #1
0
 // private List<StatsField> statsFieldsList;
 public Stats(StatsField health, StatsField hunger, StatsField sleep, StatsField happiness, StatsField age)
 {
     this.health    = health;
     this.hunger    = hunger;
     this.sleep     = sleep;
     this.happiness = happiness;
     this.Age       = age;
 }
Beispiel #2
0
    public static void AddValue(StatsField statsField, float value)
    {
        statsField.Value += value;

        if (statsField.Value > statsField.MAX_VALUE)
        {
            statsField.Value = statsField.MAX_VALUE;
        }
    }
Beispiel #3
0
 void DrawStatBar(StatsField statsField, int order)
 {
     GUI.BeginGroup(new Rect(0, step * order, barlength, 32));
     GUI.Box(new Rect(0, 0, barlength, 32), progressBarEmpty);
     GUI.BeginGroup(new Rect(0, 0, statsField.Value / 100 * barlength, 32));
     GUI.Box(new Rect(0, 0, barlength, 32), progressBarFull);
     GUI.EndGroup();
     GUI.EndGroup();
     GUI.Label(new Rect(0, step * order, barlength, 32), statsField.Name + "/" + ((int)statsField.Value).ToString() + "/" + statsField.Duration + " "
               + statsField.TempDuration + "/" + statsField.BuffTime);
 }
Beispiel #4
0
    public static void HealthControll(StatsField health, StatsField atribute, float damage)
    {
        if (atribute.Value <= 0 && !atribute.IsEmpty)
        {
            health.Duration -= damage;
            atribute.IsEmpty = true;
        }
        else if (atribute.IsEmpty && atribute.Value > 0)
        {
            health.Duration += damage; //TODO:
            atribute.IsEmpty = false;
        }

        health.IsEmpty = health.Value <= 0;
    }
Beispiel #5
0
    public void timeModify(StatsField statsField)
    {
        // float oldDuration = statsField.duration;
        if (statsField.Value < 0)
        {
            statsField.Value = 0;
        }

        if (statsField.BuffTime > 0)
        {
            statsField.Value    -= Time.deltaTime / statsField.TempDuration;
            statsField.BuffTime -= Time.deltaTime;
            return;
        }

        statsField.Value -= Time.deltaTime / statsField.Duration;
    }
Beispiel #6
0
 public static void ChangeDuration(StatsField statsField, float value, float time)
 {
     statsField.TempDuration = value;
     statsField.BuffTime     = time;
 }