public new UTAutomationPlanEntry AddAction(UTAction action, Vector2 position) { var entry = AddEntry <UTAutomationPlanSingleActionEntry>(position); entry.action = action; return(entry); }
public static void CreateEcosystemPlan() { // get the folder selection // create a new plan at the currently selected folder. UTAutomationPlan plan = UTils.CreateAssetOfType <UTAutomationPlan>("name"); // create a new instance of the new class we created above. var editorModel = new PlayMakerEcosystem_uTomateModel(); editorModel.LoadPlan(plan); Selection.activeInstanceID = plan.GetInstanceID(); // now you can create actions. // FIRST ACTION UTEchoAction echoAction = UTAction.Create <UTEchoAction>(); // set their properties echoAction.text.Value = "Hello World"; echoAction.text.UseExpression = false; // this toggles f(x) // add the action to the automation plan var echoActionEntry = editorModel.AddAction(echoAction); echoActionEntry.name = "wtf"; Selection.activeInstanceID = plan.GetInstanceID(); // SECOND ACTION UTEchoAction anotherAction = UTAction.Create <UTEchoAction>(); // set their properties anotherAction.text.Value = "double dva"; anotherAction.text.UseExpression = false; // this toggles f(x) // add it as well var anotherActionEntry = editorModel.AddAction(anotherAction); //CONNECT // now connect the first echo action to the other action using the Connect method we wrote editorModel.Connect(echoActionEntry, anotherActionEntry); // finally set the echo action as first action var echoActionNode = editorModel.Graph.GetNodeFor(echoActionEntry); editorModel.SetFirstNode(echoActionNode); // if you want you can beautify the graph // so not all nodes are located at (0,0) editorModel.RelayoutPlan(); // finally you can execute your plan using UTomate.Run(plan); }
public override IEnumerator Execute(UTContext context) { if (startOfSubtree == null) { Debug.LogWarning("No subtree specified."); yield break; } UTFileUtils.FileSelectionMode theMode = UTFileUtils.FileSelectionMode.Files; if (selectionMode != null) // can happen when we migrate older automation plans which didn't have this setting. { theMode = selectionMode.EvaluateIn(context); } var theFilePropertyName = filePropertyName.EvaluateIn(context); if (string.IsNullOrEmpty(theFilePropertyName)) { throw new UTFailBuildException("You need to specify the property which holds the current file.", this); } var theIncludes = UTAction.EvaluateAll(includes, context); var theExcludes = UTAction.EvaluateAll(excludes, context); var files = UTFileUtils.CalculateFileset(theIncludes, theExcludes, theMode); var theIndexPropertyName = indexPropertyName.EvaluateIn(context); var indexPropertySet = !string.IsNullOrEmpty(theIndexPropertyName); var index = 0; foreach (var file in files) { context [theFilePropertyName] = file; if (indexPropertySet) { context [theIndexPropertyName] = index; } var enumerator = UTAutomationPlan.ExecutePath(startOfSubtree, context); do { yield return(""); } while (enumerator.MoveNext()); index++; } }
public UTAutomationPlanEntry AddAction(UTAction action) { return AddAction(action,Vector2.zero); }
public new UTAutomationPlanEntry AddAction(UTAction action, Vector2 position) { var entry = AddEntry<UTAutomationPlanSingleActionEntry>(position); entry.action = action; return entry; }
/// <summary> /// Adds an action at the given location. Internally creates a new automation plan entry and adds this to the /// automation plan. Also creates a <see cref="UTNode"/> instance representing the new automation plan entry. /// </summary> /// <param name='action'> /// Action to add. /// </param> /// <param name='position'> /// Position at which the action should be added. /// </param> public void AddAction(UTAction action, Vector2 position) { var entry = AddEntry <UTAutomationPlanSingleActionEntry> (position); entry.action = action; }
public UTAutomationPlanEntry AddAction(UTAction action) { return(AddAction(action, Vector2.zero)); }