public bool ApplyTag(GameObject tag) { if (SyringeInFillingArea == null) { EditorUtility.DisplayDialog("Flow Violation", "You need a syringe to apply a tag on.", "Ok"); // Issue warning Cant adminster without syringe tag.GetComponent <GeneralManagerScript>().Destination = TagInitialPlaceholder; return(false); } else if (SyringeInFillingArea.GetComponent <SyringeManagerScript>().IsTagged) { EditorUtility.DisplayDialog("Flow Violation", "The syringe is already tagged.", "Ok"); // Issue warning Cant adminster without syringe tag.GetComponent <GeneralManagerScript>().Destination = TagInitialPlaceholder; return(false); } else if (SyringeInFillingArea.GetComponent <SyringeManagerScript>().DrugInside == null) { EditorUtility.DisplayDialog("Flow Violation", "Please fill the syringe first.", "Ok"); // Issue warning Cant adminster without syringe tag.GetComponent <GeneralManagerScript>().Destination = TagInitialPlaceholder; return(false); } else { // if it passed all the above ifs, then it is good to go SyringeInFillingArea.GetComponent <SyringeManagerScript>().IsTagged = true; SyringeInFillingArea.GetComponent <SyringeManagerScript>().TagDrug = tag.GetComponent <TagManagerScript>().DrugName; SyringeInFillingArea.GetComponent <SyringeManagerScript>().TagVolume = tag.GetComponent <TagManagerScript>().Volume; tag.transform.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast"); this.gameObject.GetComponent <CsvOutputWrite>().AddEvent("SyringeTagged", SyringeInFillingArea); return(true); } }
public void FillSyringe() { if (SyringeInFillingArea == null) { this.gameObject.GetComponent <PopupWindow>().Open("You cant Fill without connecting a syringe."); //EditorUtility.DisplayDialog("Flow Violation", , "Ok"); // Issue warning Cant fill without syringe return; } if (SyringeInFillingArea.GetComponent <SyringeManagerScript>().SyringeStatus == SyringeManagerScript.Status.OnFillingPosition) { if (VialInFillingArea != null) { //filling syringe SyringeInFillingArea.GetComponent <SyringeManagerScript>().DrugInside = VialInFillingArea.GetComponent <VialManagerScript>().DrugInside; SyringeInFillingArea.GetComponent <SyringeManagerScript>().VolumeInside = AmmountSlider.value; SyringeInFillingArea.GetComponent <SyringeManagerScript>().SyringeStatus = SyringeManagerScript.Status.Filled; SyringeInFillingArea.GetComponent <SyringeManagerScript>().TimeFinishedFilling = DateTime.Now.ToShortTimeString(); //adding a tag to the label area AddNewTag(SyringeInFillingArea.GetComponent <SyringeManagerScript>().DrugInside); FillButton.interactable = false; //removing vial VialInFillingArea.GetComponent <GeneralManagerScript>().Disconnect(); gameObject.GetComponent <DisplayTextScript>().SetVialInfo(); Destroy(VialInFillingArea); this.gameObject.GetComponent <CsvOutputWrite>().AddEvent("SyringeFilled", SyringeInFillingArea); } else { EditorUtility.DisplayDialog("Flow Violation", "You cant Fill a syringe without connecting a vial.", "Ok"); // Issue warning Cant fill without vial } return; } else { throw new Exception("trying to fill a filled syringe"); // the flow shouldnt take us here } }