Exemplo n.º 1
0
    //Not using deliverymethod system since it's problematic
    //check if correct deliverymethod -->syringe#syringeCapacity#amountToTake
    //public static List<DeliveryTool> deliveryTools = new List<DeliveryTool>(); //deliverytools are syringe, cup of water, needlecontainer, IV_hand
    //add when interacted with (e.G. snap on body, snap needle on container)

    public static void ResetTracking()
    {
        //REMEMBER ONLY to call this after XMLDATA has been updated with new values
        patient  = XMLData.appData.mPatients[XMLData.scenario.mPatientID];
        medicine = XMLData.appData.mMedicines[XMLData.scenario.mMedicineID];
        if (medicine.mName.Contains("#"))
        {
            medicine = medicine.CleanUpName();
        }

        List <string> deliveryMethodFromXML = new List <string>(); //gets a string list of the deliverymethod(list of tools) from active scenario

        foreach (int index in XMLData.appData.mMethods[XMLData.scenario.mDeliveryMethod].mTools)
        {
            try
            {
                deliveryMethodFromXML.Add(XMLData.appData.mTools[index].mName.ToLower());
            }
            catch (System.Exception e)
            {
                Debug.Log("Error trying to read in DeliveryTools from XML. Check XML. Error:" + e);
            }
        }

        usingSyringe = false;
        List <SyringeData> syringesToUse = new List <SyringeData>(); //For advanced use later. Right now only using one syringe

        foreach (var item in deliveryMethodFromXML)
        {
            if (item.Contains(SYRINGE)) //if this is the case it should have following structure : syringe#50#IV#2.5(amount to pull)
            {
                usingSyringe = true;
                string[]     values       = item.Split('#');
                NeedleOption needleOption = NeedleOption.IV;

                switch (values[2].ToLower())
                {
                case "iv":
                    needleOption = NeedleOption.IV;
                    break;

                case "im":
                    needleOption = NeedleOption.IM;
                    break;

                case "sc":
                    needleOption = NeedleOption.SC;
                    break;

                case "transfer":
                    needleOption = NeedleOption.Transfer;
                    break;

                default:
                    Debug.Log("There might be a problem with your XML. Invalid needle type.");
                    break;
                }
                syringesToUse.Add(new SyringeData(float.Parse(values[1]), needleOption, float.Parse(values[3])));
            }
        }
        if (usingSyringe)
        {
            syringeData = syringesToUse[0]; //only using first one for now.
        }


        wrongPatient = 0;
        interactedWithCorrectPatient = false;
        checkPatient             = false;
        wrongMedicines           = 0;
        correctMedicineRetrieved = false;
        quantityApplied          = 0;
        amountOfLiquidApplied    = 0f;
        correctNeedle            = false;
        correctInjectionMethod   = false;
        correctPlaceOnBody       = false;
        correctSyringe           = false;
    }