Grundlagen für Effizienz und Arbeitssicherheit geschaffen
This commit is contained in:
parent
85b4f86b31
commit
496a54c878
|
@ -1,16 +1,63 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
|
|
||||||
public class Developer : MonoBehaviour
|
public class Developer : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
private string _name;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gibt die Effizienz des Entwicklers in Prozent zurück.
|
/// Manche Entwickler sind einfach effizienter als andere.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float Efficiency => 1.0f;
|
[SerializeField]
|
||||||
|
private double _baseEfficiency = 1.0;
|
||||||
|
|
||||||
|
[SerializeField, ShowOnly]
|
||||||
|
private double currentCurrentEfficiency = 1.0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ich hoffe, dass der Entwickler eine Arbeitsunfähigkeitsversicherung hat.
|
||||||
|
/// </summary>
|
||||||
|
[SerializeField]
|
||||||
|
private int _fingersLeft = 10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt die Grundeffizienz des Entwicklers zurück.
|
||||||
|
/// </summary>
|
||||||
|
public double BaseEfficiency => _baseEfficiency;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt die Anzahl der Finger zurück.
|
||||||
|
/// </summary>
|
||||||
|
public int FingersLeft => _fingersLeft;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt die aktuelle Effizienz des Entwicklers in Prozent zurück.
|
||||||
|
/// </summary>
|
||||||
|
public double CurrentEfficiency => currentCurrentEfficiency;
|
||||||
|
|
||||||
|
public string Name => _name;
|
||||||
|
|
||||||
public void UpdateEfficiency()
|
public void UpdateEfficiency()
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
currentCurrentEfficiency = _baseEfficiency * (_fingersLeft / 10.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Der Entwickler wird verletzt und der Idiot bricht sich ausgerechnet einen Finger...
|
||||||
|
/// </summary>
|
||||||
|
public void Hurt()
|
||||||
|
{
|
||||||
|
_fingersLeft--;
|
||||||
|
|
||||||
|
// Ob er stirbt oder nicht, für uns hat er auf jeden Fall seinen Nutzen verloren.
|
||||||
|
if (_fingersLeft == 0)
|
||||||
|
Die();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Die()
|
||||||
|
{
|
||||||
|
Debug.Log($"{Name} ist verreckt.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class GameManager : MonoBehaviour
|
||||||
foreach (Developer developer in _developers)
|
foreach (Developer developer in _developers)
|
||||||
{
|
{
|
||||||
developer.UpdateEfficiency();
|
developer.UpdateEfficiency();
|
||||||
developerEfficiency += developer.Efficiency;
|
developerEfficiency += developer.CurrentEfficiency;
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentEfficiency = developerEfficiency;
|
_currentEfficiency = developerEfficiency;
|
||||||
|
|
Loading…
Reference in New Issue