public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { var condition = Condition.Execute(variables, VariableType.Bool); if (condition.AsBool) { graph.GoTo(OnTrue, nameof(OnTrue)); } else { graph.GoTo(OnFalse, nameof(OnFalse)); } yield break; }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { var index = Switch.Execute(variables, VariableType.Int).AsInt; if (index >= 0 && index < Outputs.Count) { graph.GoTo(Outputs[index], GetConnectionName(nameof(Outputs), index)); } else { graph.GoTo(Default, nameof(Default)); } yield break; }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { var name = Switch.Execute(variables, VariableType.String).AsString; if (Outputs.TryGetValue(name, out var output)) { graph.GoTo(output, GetConnectionName(nameof(Outputs), name)); } else { graph.GoTo(Default, nameof(Default)); } yield break; }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { if (Target.IsValid) { var target = Target.Execute <Object>(variables); if (target is GameObject gameObject) { gameObject.SetActive(true); } else if (target is Behaviour behaviour) { behaviour.enabled = true; } else if (target is Renderer renderer) { renderer.enabled = true; } else { Debug.LogWarningFormat(this, _invalidObjectWarning, name, Target); } } graph.GoTo(Next, nameof(Next)); yield break; }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { var text = Message.Execute(variables, VariableType.String); Debug.Log(text.AsString); graph.GoTo(Next, nameof(Next)); yield break; }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { if (Target.IsValid) { var target = Target.Execute <Object>(variables); Destroy(target); } graph.GoTo(Next, nameof(Next)); yield break; }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { var prefabVariable = Prefab.Resolve(variables); if (prefabVariable.TryGetObject(out GameObject prefab)) { GameObject spawned = null; var position = Position.Resolve(variables, VariableType.Vector3); var rotation = Rotation.Resolve(variables, VariableType.Quaternion); if (Positioning == ObjectPositioning.Absolute) { spawned = Instantiate(prefab, position.AsVector3, rotation.AsQuaternion); } else if (Positioning == ObjectPositioning.Relative) { if (Object.IsValid) { var obj = Object.Execute <GameObject>(variables); spawned = Instantiate(prefab, obj.transform.position + position.AsVector3, rotation.AsQuaternion); } } else if (Positioning == ObjectPositioning.Child) { if (Parent.IsValid) { var parent = Parent.Execute <GameObject>(variables); spawned = Instantiate(prefab, parent.transform.position + position.AsVector3, rotation.AsQuaternion, parent.transform); } } if (spawned) { var objectName = ObjectName.Resolve(variables, VariableType.String).AsString; if (!string.IsNullOrEmpty(objectName)) { spawned.name = objectName; } if (ObjectVariable.IsValid) { ObjectVariable.Assign(variables, Variable.Object(spawned)); } } } graph.GoTo(Next, nameof(Next)); yield break; }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { if (WaitForCompletion) { yield return(LoadScene(variables)); } else { CompositionManager.Instance.StartCoroutine(LoadScene(variables)); } graph.GoTo(Next, nameof(Next)); }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { var type = Type.GetType(ScriptableObjectType, false); var obj = CreateInstance(type); if (ObjectVariable.IsValid) { ObjectVariable.Assign(variables, Variable.Object(obj)); } graph.GoTo(Next, nameof(Next)); yield break; }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { var variable = Time.Resolve(variables, VariableType.Float); if (UseScaledTime) { yield return(new WaitForSeconds(variable.AsFloat)); } else { yield return(new WaitForSecondsRealtime(variable.AsFloat)); } graph.GoTo(Next, nameof(Next)); }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { // TODO: inputs // TODO: add a RunParallel to IGraphRunner instead of CompositionManager.Instance.StartCoroutine var target = TargetGraph.Resolve <Graph>(variables); if (WaitForCompletion) { yield return(target.Execute()); } else { CompositionManager.Instance.StartCoroutine(target.Execute()); } graph.GoTo(Next, nameof(Next)); }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { yield return(null); graph.GoTo(Next, nameof(Next)); }
public override IEnumerator Run(IGraphRunner graph, IVariableDictionary variables) { Expression.Execute(variables); graph.GoTo(Next, nameof(Next)); yield break; }