Example #1
0
        private IEnumerator LoadScene(IVariableDictionary variables)
        {
            var variable = Scene.Resolve(variables, VariableType.Asset);

            yield return(variable.AsAsset.LoadSceneAsync(Additive ? LoadSceneMode.Additive : LoadSceneMode.Single));

            if (Cleanup)
            {
                yield return(Resources.UnloadUnusedAssets());
            }
        }
Example #2
0
        private IEnumerator UnloadScene(IVariableDictionary variables)
        {
            var variable = Scene.Resolve(variables, VariableType.Asset);

            yield return(variable.AsAsset.UnLoadScene());

            if (Cleanup)
            {
                yield return(Resources.UnloadUnusedAssets());
            }
        }
Example #3
0
        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;
        }
Example #4
0
        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));
        }
Example #5
0
        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));
        }