Beispiel #1
0
        protected override void Execute(NativeActivityContext context)
        {
            bool   killall            = KillAll.Get(context);
            bool   killself           = KillSelf.Get(context);
            string WorkflowInstanceId = context.WorkflowInstanceId.ToString();
            string workflowid         = workflow.Get(context);

            if (killall)
            {
                workflowid = "";
            }
            if (string.IsNullOrEmpty(workflowid) && !killall)
            {
                throw new Exception("Kill all not enabled and no workflow selected");
            }
            int result = 0;

            try
            {
                var Instance = WorkflowInstance.Instances.Where(x => x.InstanceId == context.WorkflowInstanceId.ToString()).FirstOrDefault();
                foreach (var i in global.OpenRPAClient.WorkflowInstances.ToList())
                {
                    if (!killself && i.InstanceId == WorkflowInstanceId)
                    {
                        continue;
                    }
                    if (!i.isCompleted)
                    {
                        if (!string.IsNullOrEmpty(workflowid))
                        {
                            if (i.Workflow != null && i.Workflow._id == workflowid || i.Workflow.RelativeFilename == workflowid || i.Workflow.ProjectAndName == workflowid)
                            {
                                i.Abort("Killed by StopOpenRPA command from " + Instance.Workflow.name);
                                result++;
                            }
                        }
                        else
                        {
                            i.Abort("Killed StopOpenRPA command from " + Instance.Workflow.name);
                            result++;
                        }
                    }
                }
                Result.Set(context, result);
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
                throw;
            }
        }
    void Start()
    {
        player = FindObjectOfType <Player>();
        GameManager gm = GameManager.instance;

        if (FindObjectOfType <LlegarMeta>() != null)
        {
            llegarMeta             = FindObjectOfType <LlegarMeta>();
            gm.CondicionDeVictoria = "Meta";
        }
        else if (FindObjectOfType <Collect>() != null)
        {
            collect = FindObjectOfType <Collect>();
            gm.CondicionDeVictoria = "Recolectar";
        }
        else if (FindObjectOfType <Transport>() != null)
        {
            transport = FindObjectOfType <Transport>();
            gm.CondicionDeVictoria = "Transportar";
        }
        else if (FindObjectOfType <KillAll>() != null)
        {
            killAll = FindObjectOfType <KillAll>();
            gm.CondicionDeVictoria = "MatarATodos";
        }
        else if (FindObjectOfType <Kill>() != null)
        {
            kill = FindObjectOfType <Kill>();
            gm.CondicionDeVictoria = "Matar";
        }
        else if (FindObjectOfType <Survive>() != null)
        {
            survive = FindObjectOfType <Survive>();
            gm.CondicionDeVictoria = "Sobrevivir";
        }
    }