示例#1
0
    private void ApplyPotion(Potion potion, bool addScoreOnSuccess)
    {
        if (!resolvingPotion)
        {
            resolvingPotion = true;
            OnCanBrewStateChange?.Invoke(CanBrew);

            // Store the patients symptoms for later
            HashSet <eSymptom> symptomsBefore = new HashSet <eSymptom>(patientSymptomManager.symptoms);

            // Apply potion to patient and score accordingly
            bool isPatientCured = patientSymptomManager.ApplyPotionToPatient(potion.GetSymptomChange());
            PatientsCured += (addScoreOnSuccess && isPatientCured) ? 1 : 0;

            // Log experiment results
            HashSet <eSymptom> symptomsAfter = new HashSet <eSymptom>(patientSymptomManager.symptoms);
            ExperimentResult   newResult     = new ExperimentResult(symptomsBefore, potion.PotionComposition, symptomsAfter);
            experimentResults.Add(newResult);
            ExperimentResultsChanged?.Invoke(experimentResults);
        }
        else
        {
            Debug.Log("OnPatientFinished must be called before another potion can be applied!");
        }
    }
示例#2
0
    /// <summary>
    /// Called when patient is finished animating away.
    /// </summary>
    public void OnPatientFinished(bool reducePatients)
    {
        PatientsToGo -= reducePatients ? 1 : 0;

        if (PatientsToGo <= 0)
        {
            // End game and send score
            OnGameEnd?.Invoke(PatientsCured, patientsTotal);
        }
        else
        {
            // Next patient
            patientSymptomManager.ResetPatient();
            resolvingPotion = false;
            OnCanBrewStateChange?.Invoke(CanBrew);
        }
    }
示例#3
0
 public void SetIngredient(int index, Ingredient ingredient)
 {
     ingredients[index] = ingredient;
     OnIngredientChange?.Invoke(index, ingredient);
     OnCanBrewStateChange?.Invoke(CanBrew);
 }