2024-04-04 15:26:31 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2024-04-04 18:13:08 +02:00
|
|
|
using UnityEngine.Serialization;
|
2024-04-04 19:41:19 +02:00
|
|
|
using Utility;
|
2024-04-04 15:26:31 +02:00
|
|
|
|
|
|
|
public class Developer : MonoBehaviour
|
|
|
|
{
|
2024-04-04 18:13:08 +02:00
|
|
|
private string _name;
|
|
|
|
|
|
|
|
[SerializeField]
|
|
|
|
private double _baseEfficiency = 1.0;
|
2024-04-04 16:33:12 +02:00
|
|
|
|
2024-04-04 18:13:08 +02:00
|
|
|
[SerializeField, ShowOnly]
|
2024-04-04 19:41:19 +02:00
|
|
|
private double _currentCurrentEfficiency = 1.0;
|
2024-04-04 18:13:08 +02:00
|
|
|
|
|
|
|
[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>
|
2024-04-04 19:41:19 +02:00
|
|
|
public double CurrentEfficiency => _currentCurrentEfficiency;
|
2024-04-04 18:13:08 +02:00
|
|
|
|
|
|
|
public string Name => _name;
|
|
|
|
|
2024-04-04 16:33:12 +02:00
|
|
|
public void UpdateEfficiency()
|
|
|
|
{
|
2024-04-04 19:41:19 +02:00
|
|
|
_currentCurrentEfficiency = _baseEfficiency * (_fingersLeft / 10.0);
|
2024-04-04 18:13:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <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.");
|
2024-04-04 16:33:12 +02:00
|
|
|
}
|
2024-04-04 15:26:31 +02:00
|
|
|
}
|