private void LevelEnded()
    {
        try
        {
            m_floatTextController.UpdateFloatTextSettings(AnimationTypeIndex.FarToNear, "Level up!", Color.green);
        }
        catch (Exception e)
        {
            MainController.PrintToLog("cant do level up animation - " + e.ToString(), MainController.LogType.Error);
        }
        m_mainController.CurrentPatient.TreatmentsHistory.Add(m_mainController.CurrentPatient.CurrentTreatment);
        int newTreatmentNumber = m_mainController.CurrentPatient.CurrentTreatment.TreatmentNumber + 1;
        int ST = 0;

        foreach (Challenge c in m_mainController.CurrentPatient.CurrentTreatment.Plan)
        {
            ST += c.ActionsList.Count;
        }

        m_mainController.CurrentPatient.CurrentTreatment = new TreatmentPlan()
        {
            TreatmentNumber = newTreatmentNumber,
            CreationTime    = DateTime.Now.ToShortDateString() + " " +
                              DateTime.Now.ToLongTimeString(),
            Plan = Algorithm.GenerateNewLevel(m_mainController.CurrentPatient.CurrentTreatment.Plan, PinchManager.PT, ST)
        };
        PinchManager.PT = 0;
        InitilizeSceneAccordingToPlan();
    }
コード例 #2
0
    private void LevelEnded()
    {
        m_mainController.m_audioSource.volume = 0.1f;
        try
        {
            m_floatTextController.UpdateFloatTextSettings(AnimationTypeIndex.BottomToTop, "Level up!", Color.green);
        }
        catch (Exception e)
        {
            MainController.PrintToLog("Can't do level up animation - " + e.ToString(), MainController.LogType.Error);
        }
        try
        {
            m_audioSource.clip = m_winningSound;
            m_audioSource.Play();
        }
        catch (Exception e)
        {
            MainController.PrintToLog("Can't play winning sound - " + e.ToString(), MainController.LogType.Error);
        }

        m_mainController.CurrentPatient.TreatmentsHistory.Add(m_mainController.CurrentPatient.CurrentTreatment);
        int newTreatmentNumber = m_mainController.CurrentPatient.CurrentTreatment.TreatmentNumber + 1;
        int ST = 0;

        foreach (Challenge c in m_mainController.CurrentPatient.CurrentTreatment.Plan)
        {
            ST += c.ActionsList.Count;
        }

        m_mainController.CurrentPatient.CurrentTreatment = new TreatmentPlan()
        {
            TreatmentNumber = newTreatmentNumber,
            CreationTime    = DateTime.Now.ToShortDateString() + " " +
                              DateTime.Now.ToLongTimeString(),
            Plan = Algorithm.GenerateNewLevel(m_mainController.CurrentPatient.CurrentTreatment.Plan, PinchManager.PT, ST)
        };
        PinchManager.PT = 0;
        try
        {
            QuestFileManager.UpdatePatientOnFile(m_mainController.CurrentPatient, PinchConstants.PatientsDirectoryPath + m_mainController.CurrentPatient.Id);
        }
        catch (Exception e)
        {
            MainController.PrintToLog("Can't update patient file in TherapyManager - " + e.ToString(), MainController.LogType.Error);
        }
        InitilizeSceneAccordingToPlan();
    }