Beispiel #1
0
    // Start is called before the first frame update
    private void Start()
    {
        healthStatus.AddCompanions(this);

        //get health
        if (companion1)
        {
            companionCurrentHealth = Stats.Companion1Health;
            companionName          = Stats.Companion1Name;
        }
        else if (companion2)
        {
            companionCurrentHealth = Stats.Companion2Health;
            companionName          = Stats.Companion2Name;
        }
        else if (companion3)
        {
            companionCurrentHealth = Stats.Companion3Health;
            companionName          = Stats.Companion3Name;
        }
        else if (companion4)
        {
            companionCurrentHealth = Stats.Companion4Health;
            companionName          = Stats.Companion4Name;
        }

        //update status message
        if (companionCurrentHealth <= 0)
        {
            statusMessage = "This survivor has died...Rest In Peace ";
            healthStatus.NotifyObservers();
        }
        else if (companionCurrentHealth < 5)
        {
            statusMessage = "This survivor is seriously injured and needs immediate medical attention";
            healthStatus.NotifyObservers();
        }
        else if (companionCurrentHealth < 10 && companionCurrentHealth > 5)
        {
            statusMessage = "This survivor is injured. They may need healing.";
            healthStatus.NotifyObservers();
        }
        else if (companionCurrentHealth >= 10)
        {
            statusMessage = "This survivor is doing well.";
            healthStatus.NotifyObservers();
        }
    }