IEnumerator SpawnEnemy() { curSe = waves[currentWave].wave[currentElement]; if (curSe.enemy) { GameObject g = curSe.enemy as GameObject; if (curSe.health > 0) { g.GetComponent <Enemy>().Health = curSe.health; } for (int i = 0; i < spawnPos.Length; i++) { if (spawnPos[i] != null) { enemyManager.AddEnemy(Instantiate(g, spawnPos[i].transform.position, Quaternion.identity) as GameObject); g.transform.position = spawnPos[i].transform.position; g.GetComponent <NavMeshAgent>().Warp(spawnPos[i].transform.position); } } } yield return(new WaitForSeconds(curSe.delay)); NextSpawn(); }
public void HandleToDoTemplateRegistration_Status_Abandoned() { ToDoActivationRule rule = new ToDoActivationRule { EndpointUtil = new StubEndpointUtils(), PlanUtils = new PlanElementUtils() }; var patientId = ObjectId.GenerateNewId().ToString(); PlanElementEventArg arg = new PlanElementEventArg { Program = new Program { Id = ObjectId.GenerateNewId().ToString(), PatientId = patientId }, UserId = "5325c821072ef705080d3488", Action = new Actions { Id = ObjectId.GenerateNewId().ToString() }, PatientId = patientId, PlanElement = new Step() }; var se = new SpawnElement { ElementType = 201, ElementId = "53ff6b92d4332314bcab46e0" }; var type = rule.Execute(arg.UserId, arg, se, new ProgramAttributeData()); Assert.AreEqual(type, 200); }
public void ExecuteTest() { // goal to patientgoal Mapper.CreateMap <Goal, PatientGoal>() .ForMember(d => d.CustomAttributes, opt => opt.MapFrom(src => src.CustomAttributes.ConvertAll( c => new CustomAttribute { Id = c.Id, Values = c.Values }))); var gar = new GoalActivationRule { EndpointUtil = new StubEndpointUtils(), PlanUtils = new StubPlanElementUtils() }; string userId = "1234"; PlanElementEventArg arg = new PlanElementEventArg { Program = new DTO.Program { Id = "111111111111111111111111" }, PatientId = "2222222222222222222222pt", UserId = "1234" }; SpawnElement pe = new SpawnElement { }; ProgramAttributeData pad = new ProgramAttributeData { }; gar.Execute(userId, arg, pe, pad); }
public static List <SpawnElement> GetADSpawnElements(List <SpawnElementDetail> list) { try { List <SpawnElement> sd = new List <SpawnElement>(); if (list != null) { list.ForEach(s => { SpawnElement sed = new SpawnElement { ElementId = s.ElementId, ElementType = s.ElementType, Tag = s.Tag }; sd.Add(sed); }); } return(sd); } catch (Exception ex) { throw new Exception("AD:GetADSpawnElements()::" + ex.Message, ex.InnerException); } }
public override SpawnType Execute(string userId, PlanElementEventArg arg, SpawnElement pe, ProgramAttributeData pad) { var spawnType = new SpawnType { Type = _alertType.ToString() }; return(spawnType); }
public override SpawnType Execute(string userId, PlanElementEventArg arg, SpawnElement pe, ProgramAttributeData pad) { HandlePatientProblemRegistration(arg, userId, pe); var spawnType = new SpawnType { Type = _alertType.ToString() }; return(spawnType); }
public override SpawnType Execute(string userId, PlanElementEventArg arg, SpawnElement se, ProgramAttributeData pad) { PlanElement value = HandlePlanElementActivation(PlanUtils, arg, se); var spawnType = new SpawnType { Type = _elementType.ToString() }; return(spawnType); }
// Use this for initialization void Start() { GameObject molenchonObj = SimplePool.Spawn(gm.MolenchonPrefab); molenchonObj.SetActive(false); molenchonObj.transform.SetParent(transform); molenchonObj.transform.localPosition = Vector3.zero; molenchonScript = molenchonObj.GetComponent <SpawnElement>(); }
public override SpawnType Execute(string userId, PlanElementEventArg arg, SpawnElement se, ProgramAttributeData pad) { PlanUtils.SetProgramAttributes(se, arg.Program, arg.UserId, pad); var spawnType = new SpawnType { Type = "KickAss" }; return(spawnType); }
public RegisterSpawnProblemCode(PlanElementEventArg e, SpawnElement rse) { _e = e; _se = rse; if (AppHostBase.Instance != null) { AppHostBase.Instance.Container.AutoWire(this); } }
public SpawnType Run(PlanElementEventArg e, SpawnElement rse, string userId, ProgramAttributeData pad) { SpawnType alert = null; alert = _progAttributeTypes.Contains(rse.ElementType) ? new ProgramAttributeActivationRule().Execute(userId, e, rse, pad) : _rules.First(r => r.ElementType == rse.ElementType).Execute(userId, e, rse, pad); return(alert); }
public void Run_ToDo_Rule() { var se = new SpawnElement { ElementType = 111 }; var arg = new PlanElementEventArg { UserId = ObjectId.GenerateNewId().ToString() }; var strat = new StubElementActivationStrategy().Run(arg, se, ObjectId.GenerateNewId().ToString(), new DataDomain.Program.DTO.ProgramAttributeData()); Assert.AreEqual(strat, "ToDo"); }
public UpdateSpawnProblemCode(PlanElementEventArg e, SpawnElement rse, PatientObservation ppd, bool active) { _e = e; _se = rse; _pod = ppd; _active = active; if (AppHostBase.Instance != null) { AppHostBase.Instance.Container.AutoWire(this); } }
IEnumerator SpawnEnemy() { curSe = waves[currentWave][currentElement]; if (curSe.enemy) { GameObject g = curSe.enemy as GameObject; if (curSe.health > 0) { g.GetComponent <Enemy>().Health = curSe.health; } enemyManager.AddEnemy(Instantiate(g, spawnPos.transform.position, Quaternion.identity) as GameObject); } yield return(new WaitForSeconds(curSe.delay)); NextSpawn(); }
public void HandlePlanElementActivation(PlanElementEventArg e, SpawnElement rse) { try { PlanElement pe = PEUtils.ActivatePlanElement(rse.ElementId, e.Program); if (pe != null) { OnProcessIdEvent(pe); } } catch (Exception ex) { throw new Exception("AD:StepPlanProcessor:HandlePlanElementActivation()::" + ex.Message, ex.InnerException); } }
public override void Execute(SpawnElement r, Program program, string userId, ProgramAttributeData progAttr) { try { if (r.Tag == null) { throw new ArgumentException("Cannot set attribute of type " + r.ElementType + ". Tag value is null."); } progAttr.Eligibility = (!string.IsNullOrEmpty(r.Tag)) ? Convert.ToInt32(r.Tag) : 0; } catch (Exception ex) { throw new Exception("AD:SetProgramAttributes()::Eligibility" + ex.Message, ex.InnerException); } int state; // no = 1, yes = 2 var isNum = int.TryParse(r.Tag, out state); if (!isNum) { return; } // program is closed due to ineligibility switch (state) { case 1: //program.ElementState = (int) DataDomain.Program.DTO.ElementState.Completed; //5; //program.StateUpdatedOn = System.DateTime.UtcNow; progAttr.Eligibility = 1; //program.AttrEndDate = System.DateTime.UtcNow; break; case 2: //program.ElementState = (int) DataDomain.Program.DTO.ElementState.InProgress; //4; //program.StateUpdatedOn = System.DateTime.UtcNow; progAttr.Eligibility = 2; break; } }
public void HandlePlanElementActions(PlanElementEventArg e, string userId, SpawnElement rse) { // handles the response spawnelements if (rse.ElementType < 10) { HandlePlanElementActivation(e, rse); } else if (rse.ElementType > 100) { //HandlePatientProblemRegistration(e, userId, rse); var type = ElementActivationStrategy.Run(e, rse, userId, ProgramAttributes); if (!string.IsNullOrEmpty(type.ToString())) { OnSpawnElementEvent(type); } } else { PEUtils.SetProgramAttributes(rse, e.Program, e.UserId, ProgramAttributes); } }
public override SpawnType Execute(string userId, PlanElementEventArg arg, SpawnElement pe, ProgramAttributeData pad) { try { Intervention interventionTemplate = null; Goal goalTemplate = null; PatientGoal patientGoal = null; PatientGoal newPGoal = null; PatientIntervention existingPatientIntervention = null; try { // get template intervention interventionTemplate = EndpointUtil.GetInterventionById(pe.ElementId, userId, arg.DomainRequest); } catch (Exception ex) { throw new Exception("AD:InterventionActivationRule:GetInterventionById()::" + ex.Message, ex.InnerException); } try { // get template goal goalTemplate = EndpointUtil.GetGoalById(interventionTemplate.TemplateGoalId, userId, arg.DomainRequest); } catch (Exception ex) { throw new Exception("AD:InterventionActivationRule:GetGoalById()::" + ex.Message, ex.InnerException); } try { // find if patientgoal exists patientGoal = EndpointUtil.GetOpenNotMetPatientGoalByTemplateId(goalTemplate.Id, arg.PatientId, userId, arg.DomainRequest); } catch (Exception ex) { throw new Exception("AD:InterventionActivationRule:GetOpenNotMetPatientGoalByTemplateId()::" + ex.Message, ex.InnerException); } if (patientGoal != null) { try { // find if patientintervention exists existingPatientIntervention = EndpointUtil.GetOpenNotMetPatientInterventionByTemplateId(patientGoal.Id, interventionTemplate.Id, arg.PatientId, userId, arg.DomainRequest); } catch (Exception ex) { throw new Exception( "AD:InterventionActivationRule:GetOpenNotMetPatientInterventionByTemplateId()::" + ex.Message, ex.InnerException); } } PatientIntervention pIntr = existingPatientIntervention; PatientGoal pGoal = patientGoal; List <object> items = null; if (InsertInterventionAllowed(pIntr)) { // check to see that goal exists if (InsertPatientGoalAllowed(patientGoal)) { // 1) insert patient goal pGoal = PlanUtils.InsertPatientGoal(arg, goalTemplate); } pIntr = PlanUtils.InsertPatientIntervention(arg, pGoal, interventionTemplate); items = CreateItemsBag(pIntr, pGoal); } var spawnType = new SpawnType { Type = _alertType.ToString(), Tag = items }; return(spawnType); } catch (Exception ex) { throw new Exception("AD:InterventionActivationRule:Execute()::" + ex.Message, ex.InnerException); } }
public abstract SpawnType Execute(string userId, PlanElementEventArg arg, SpawnElement pe, ProgramAttributeData pad);
public SpawnType Run(PlanElementEventArg e, SpawnElement rse, string userId, ProgramAttributeData pad) { var alert = _rules.First(r => r.ElementType == rse.ElementType).Execute(userId, e, rse, pad); return(alert); }
protected PlanElement HandlePlanElementActivation(IPlanElementUtils planUtils, PlanElementEventArg e, SpawnElement rse) { try { PlanElement pe = planUtils.ActivatePlanElement(rse.ElementId, e.Program); return(pe); } catch (Exception ex) { throw new Exception("AD:StepPlanProcessor:HandlePlanElementActivation()::" + ex.Message, ex.InnerException); } }
public override SpawnType Execute(string userId, PlanElementEventArg arg, SpawnElement pe, ProgramAttributeData pad) { try { Goal goalTemp = null; PatientGoal patientGoal = null; PatientGoal newPGoal = null; ToDoData todo = null; try { // get template Goal from Goal endpoint goalTemp = EndpointUtil.GetGoalById(pe.ElementId, userId, arg.DomainRequest); } catch (Exception ex) { throw new ArgumentException(ex.Message); } try { // get patient Goal from template id // this will only return patientgoals that are open or notmet state patientGoal = EndpointUtil.GetOpenNotMetPatientGoalByTemplateId(pe.ElementId, arg.PatientId, userId, arg.DomainRequest); } catch (Exception ex) { throw new ArgumentException(ex.Message); } try { //Open = 1, Met = 2, NotMet =3, Abandoned =4 if (patientGoal == null) // || (patientGoal.StatusId == 2 || patientGoal.StatusId == 4)) { newPGoal = Mapper.Map <PatientGoal>(goalTemp); newPGoal.ProgramIds = new List <string> { arg.Program.Id }; newPGoal.PatientId = arg.PatientId; newPGoal.TemplateId = goalTemp.Id; newPGoal.StartDate = PlanUtils.HandleDueDate(goalTemp.StartDateRange); newPGoal.TargetDate = PlanUtils.HandleDueDate(goalTemp.TargetDateRange); newPGoal.StatusId = 1; try { // initialize patientgoal and get id var iPG = GoalsEndpointUtil.GetInitialGoalRequest(new GetInitializeGoalRequest { Context = "NG", ContractNumber = arg.DomainRequest.ContractNumber, PatientId = arg.PatientId, Token = arg.DomainRequest.Token, UserId = arg.DomainRequest.UserId, Version = arg.DomainRequest.Version }); // update patientgoal if (iPG == null) { throw new ArgumentException("Failed to Initialize patient goal"); } newPGoal.Id = iPG.Id; GoalsEndpointUtil.PostUpdateGoalRequest(new PostPatientGoalRequest { ContractNumber = arg.DomainRequest.ContractNumber, Goal = newPGoal, PatientGoalId = iPG.Id, PatientId = arg.PatientId, Token = arg.DomainRequest.Token, UserId = arg.DomainRequest.UserId, Version = arg.DomainRequest.Version }); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } } } catch (Exception ex) { throw new ArgumentException("PatientGoal Hydration Error." + ex.Message); } var spawnType = new SpawnType { Type = _alertType.ToString(), Tag = new List <object> { newPGoal } }; return(spawnType); } catch (Exception ex) { throw new Exception("AD:ToDoActivationRule:Execute()::" + ex.Message, ex.InnerException); } }
public void Run(SpawnElement r, Program program, string userId, ProgramAttributeData progAttr) { _rules.First(a => a.ProgramAttributeType == r.ElementType).Execute(r, program, userId, progAttr); }
public void HandlePatientProblemRegistration(PlanElementEventArg e, string userId, SpawnElement rse) { try { // check if problem code is already registered for patient var ppd = EndpointUtil.GetPatientProblem(rse.ElementId, e, userId); if (ppd != null) { var uspc = new UpdateSpawnProblemCode(e, rse, ppd, true) { EndPointUtil = EndpointUtil }; var updateSpawnProblemCode = new SpawnElementStrategy(uspc); if (ppd.StateId != 2) { updateSpawnProblemCode.Evoke(); } } else { var spc = new RegisterSpawnProblemCode(e, rse) { EndPointUtil = EndpointUtil }; var registerSpawnProblemCode = new SpawnElementStrategy(spc); registerSpawnProblemCode.Evoke(); } // register new problem code with cohortpatientview PlanUtils.RegisterCohortPatientViewProblemToPatient(rse.ElementId, e.PatientId, e.DomainRequest); } catch (Exception ex) { throw new Exception("AD:StepPlanProcessor:HandlePatientProblemRegistration()::" + ex.Message, ex.InnerException); } }
public override SpawnType Execute(string userId, PlanElementEventArg arg, SpawnElement pe, ProgramAttributeData pad) { try { #region //Goal goalTemp = null; //Intervention interventionTemp = null; //PatientIntervention patientInt = null; //PatientIntervention newPInt = null; //ToDoData todo = null; //try //{ // // get patientintervention template by id // interventionTemp = EndpointUtil.GetGoalById(pe.ElementId, userId, arg.DomainRequest); //} //catch(Exception ex) //{ // throw new ArgumentException(ex.Message); //} //try //{ // // get template Goal from Goal endpoint // patientGoal = EndpointUtil.GetOpenNotMetPatientGoalByTemplateId(pe.ElementId, arg.PatientId, userId, arg.DomainRequest); //} //catch (Exception ex) //{ // throw new ArgumentException(ex.Message); //} //try //{ // //Open = 1, Met = 2, NotMet =3, Abandoned =4 // if (patientGoal == null || (patientGoal.StatusId == 2 || patientGoal.StatusId == 4)) // { // newPGoal = Mapper.Map<PatientGoal>(goalTemp); // newPGoal.ProgramIds = new List<string> {arg.Program.Id}; // newPGoal.PatientId = arg.PatientId; // newPGoal.StatusId = 1; // try // { // // register new patientobservation // // initialize patientgoal and get id // var iPG = GoalsEndpointUtil.GetInitialGoalRequest(new GetInitializeGoalRequest // { // Context = "NG", // ContractNumber = arg.DomainRequest.ContractNumber, // PatientId = arg.PatientId, // Token = arg.DomainRequest.Token, // UserId = arg.DomainRequest.UserId, // Version = arg.DomainRequest.Version // }); // // update patientgoal // if (iPG == null) // throw new ArgumentException("Failed to Initialize patient goal"); // newPGoal.Id = iPG.Id; // GoalsEndpointUtil.PostUpdateGoalRequest(new PostPatientGoalRequest // { // ContractNumber = arg.DomainRequest.ContractNumber, // Goal = newPGoal, // PatientGoalId = iPG.Id, // PatientId = arg.PatientId, // Token = arg.DomainRequest.Token, // UserId = arg.DomainRequest.UserId, // Version = arg.DomainRequest.Version // }); // } // catch (Exception ex) // { // throw new Exception(ex.Message, ex.InnerException); // } // } //} //catch (Exception ex) //{ // throw new ArgumentException("PatientGoal Hydration Error." + ex.Message); //} #endregion Task taskTemplate = null; Goal goalTemplate = null; PatientGoal patientGoal = null; PatientGoal newPGoal = null; PatientTask existingPatientTask = null; // get template intervention taskTemplate = EndpointUtil.GetTaskById(pe.ElementId, userId, arg.DomainRequest); // get template goal goalTemplate = EndpointUtil.GetGoalById(taskTemplate.TemplateGoalId, userId, arg.DomainRequest); // find if patientgoal exists patientGoal = EndpointUtil.GetOpenNotMetPatientGoalByTemplateId(goalTemplate.Id, arg.PatientId, userId, arg.DomainRequest); if (patientGoal != null) { // find if patientintervention exists existingPatientTask = EndpointUtil.GetOpenNotMetPatientTaskByTemplateId(patientGoal.Id, taskTemplate.Id, arg.PatientId, userId, arg.DomainRequest); } PatientTask pTsk = existingPatientTask; PatientGoal pGoal = patientGoal; List <object> items = null; if (InsertTaskAllowed(existingPatientTask)) { // check to see that goal exists if (InsertPatientGoalAllowed(patientGoal)) { // 1) insert patient goal pGoal = PlanUtils.InsertPatientGoal(arg, goalTemplate); } // insert patient intervention pTsk = PlanUtils.InsertPatientTask(arg, pGoal, taskTemplate); items = CreateItemsBag(pTsk, pGoal); } var spawnType = new SpawnType { Type = _alertType.ToString(), Tag = items }; return(spawnType); } catch (Exception ex) { throw new Exception("AD:TaskActivationRule:Execute()::" + ex.Message, ex.InnerException); } }
public abstract void Execute(SpawnElement r, Program program, string userId, ProgramAttributeData progAttr);
public override SpawnType Execute(string userId, PlanElementEventArg arg, SpawnElement pe, ProgramAttributeData pad) { try { Schedule todoTemp = null; ToDoData todo = null; if (!PatientToDoExists(arg, pe.ElementId)) { try { // get template todo from schedule endpoint todoTemp = EndpointUtil.GetScheduleToDoById(pe.ElementId, userId, arg.DomainRequest); } catch (Exception ex) { throw new ArgumentException(ex.Message); } var prog = new System.Collections.Generic.List <string>(); if (arg.Program != null) { prog.Add(arg.Program.Id); } string patientId = null; if (arg.Program != null) { patientId = arg.Program.PatientId; } try { todo = new ToDoData { SourceId = todoTemp.Id, Title = todoTemp.Title, CategoryId = todoTemp.CategoryId, CreatedById = userId, StatusId = todoTemp.StatusId, Description = todoTemp.Description, PriorityId = todoTemp.PriorityId, DueDate = HandleDueDate(todoTemp.DueDateRange), StartTime = todoTemp.StartTime, Duration = todoTemp.Duration, PatientId = patientId, ProgramIds = prog, CreatedOn = DateTime.UtcNow }; SetDefaultAssignment(userId, todoTemp, todo); // modified for ENG-709 if (todo.StatusId == 2 || todo.StatusId == 4) { todo.ClosedDate = DateTime.UtcNow; } } catch (Exception ex) { throw new ArgumentException("ToDoData Hydration Error." + ex.Message); } try { // register new todo var result = EndpointUtil.PutInsertToDo(todo, arg.UserId, arg.DomainRequest); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } } var spawnType = new SpawnType { Type = _alertType.ToString() }; return(spawnType); } catch (Exception ex) { throw new Exception("AD:ToDoActivationRule:Execute()::" + ex.Message, ex.InnerException); } }