public override IEnumerator <Yield> Exec
            (Socket from, Socket to, GraphScope scope)
        {
            var agent = new GameObject().AddComponent <RotateAgent>();

            agent.target          = transform;
            agent.relativeTo      = relativeTo;
            agent.axis            = axis;
            agent.degrees         = degrees;
            agent.seconds         = seconds;
            agent.easing          = easing;
            agent.ignoreTimeScale = ignoreTimeScale;
            agent.Move();

            if (waitUntilDone)
            {
                while (!Util.IsNull(agent))
                {
                    yield return(new WaitForUpdate());
                }
            }

            transformOut = transform;
            yield return(new SignalSocket(scope, GetSocket("execOut")));
        }
        public override IEnumerator <Yield> Exec
            (Socket from, Socket to, GraphScope scope)
        {
            yield return(new WaitForSeconds(seconds));

            yield return(new SignalSocket(scope, GetSocket("execOut")));
        }
Beispiel #3
0
        public override void Eval(GraphScope scope)
        {
            switch (type)
            {
            case TimeType.DeltaTime:
                delta = Time.deltaTime;
                break;

            case TimeType.UnscaledDeltaTime:
                delta = Time.unscaledDeltaTime;
                break;

            case TimeType.SmoothDeltaTime:
                delta = Time.smoothDeltaTime;
                break;

            case TimeType.SecondsSinceGameStart:
                delta = Time.time;
                break;

            case TimeType.UnscaledSecondsSinceGameStart:
                delta = Time.unscaledTime;
                break;
            }
        }
        public override IEnumerator <Yield> Exec
            (Socket from, Socket to, GraphScope scope)
        {
            transform.localScale = scale;

            transformOut = transform;
            yield return(new SignalSocket(scope, GetSocket("execOut")));
        }
Beispiel #5
0
 public override IEnumerator <Yield> Exec
     (Socket from, Socket to, GraphScope scope)
 {
     transform.Translate(meters * delta, relativeTo);
     transformOut = transform;
     deltaOut     = delta;
     yield return(new SignalSocket(scope, GetSocket("execOut")));
 }
 public override IEnumerator <Yield> Exec
     (Socket from, Socket to, GraphScope scope)
 {
     transform.RotateAround(point, axis, degrees * delta);
     transformOut = transform;
     deltaOut     = delta;
     yield return(new SignalSocket(scope, GetSocket("execOut")));
 }
Beispiel #7
0
 public override IEnumerator <Yield> Exec
     (Socket from, Socket to, GraphScope scope)
 {
     if (condition)
     {
         yield return(new SignalSocket(scope, GetSocket("execTrue")));
     }
     else
     {
         yield return(new SignalSocket(scope, GetSocket("execFalse")));
     }
 }
Beispiel #8
0
        public override IEnumerator <Yield> Exec
            (Socket from, Socket to, GraphScope scope)
        {
            if (immediate)
            {
                DestroyImmediate(toDestroy, false);
            }
            else
            {
                Destroy(toDestroy, seconds);
            }

            yield return(new SignalSocket(scope, GetSocket("execOut")));
        }
Beispiel #9
0
        public override IEnumerator <Yield> Exec
            (Socket from, Socket to, GraphScope scope)
        {
            while (condition)
            {
                // Create a copy of the scope to force re-eval every time this
                // loops
                var newScope = new GraphScope(scope);

                yield return(new SignalSocket(newScope, GetSocket("execTrue")));

                // Force re-evaluation of this node
                Eval(scope);
            }
        }
Beispiel #10
0
        public override IEnumerator <Yield> Exec
            (Socket from, Socket to, GraphScope scope)
        {
            if (relativeTo == Space.Self)
            {
                transform.localRotation = Quaternion.Euler(rotation);
            }
            else
            {
                transform.rotation = Quaternion.Euler(rotation);
            }

            transformOut = transform;
            yield return(new SignalSocket(scope, GetSocket("execOut")));
        }
Beispiel #11
0
        public override IEnumerator <Yield> Exec
            (Socket from, Socket to, GraphScope scope)
        {
            switch (severity)
            {
            case LogType.Info:
                Debug.Log(message, context);
                break;

            case LogType.Warning:
                Debug.LogWarning(message, context);
                break;

            case LogType.Error:
                Debug.LogError(message, context);
                break;
            }

            yield return(new SignalSocket(scope, GetSocket("execOut")));
        }
Beispiel #12
0
 public override IEnumerator <Yield> Exec
     (Socket from, Socket to, GraphScope scope)
 {
     if (to.FieldName == "open")
     {
         isOpen = true;
     }
     else if (to.FieldName == "close")
     {
         isOpen = false;
     }
     else if (isOpen)
     {
         yield return(new SignalSocket(scope, GetSocket("execOut")));
     }
     else
     {
         yield return(null);
     }
 }
Beispiel #13
0
        public override IEnumerator <Yield> Exec
            (Socket from, Socket to, GraphScope scope)
        {
            if (!Util.IsNull(transform))
            {
                childTransform = transform.Find(childName);
            }
            else
            {
                childTransform = null;
            }

            if (!Util.IsNull(childTransform))
            {
                childGameObject = childTransform.gameObject;
            }
            else
            {
                childGameObject = null;
            }

            yield return(new SignalSocket(scope, GetSocket("execOut")));
        }
Beispiel #14
0
 public static GremlinQuery SkipTake(this GremlinQuery queryBase, GraphScope scope, int skip, int take)
 {
     return(queryBase.Range(scope, skip, skip + take));
 }
Beispiel #15
0
 public override void Eval(GraphScope scope)
 {
     result = Mathf.LerpAngle(a, b, t);
 }
Beispiel #16
0
 public override void Eval(GraphScope scope)
 {
     result = Mathf.Clamp(f, min, max);
 }
 public static GremlinQuery Tail(this GremlinQuery queryBase, GraphScope scope, int last)
 {
     return(new ComposedGremlinQuery(queryBase, $"tail({scope.ToString().ToLower()},{last})"));
 }
Beispiel #18
0
 public static GremlinQuery Skip(this GremlinQuery queryBase, GraphScope scope, int itemsToSkip)
 {
     return(queryBase.Range(scope, itemsToSkip, -1));
 }
Beispiel #19
0
 public static GremlinQuery Range(this GremlinQuery queryBase, GraphScope scope, int lowEnd, int highEnd)
 {
     return(new ComposedGremlinQuery(queryBase, $".range({scope.ToString().ToLower()},{queryBase.ComposeParameter(lowEnd)},{queryBase.ComposeParameter(highEnd)})"));
 }
 public static GremlinQuery Skip(this GremlinQuery queryBase, GraphScope scope, int itemsToSkip)
 {
     return(new ComposedGremlinQuery(queryBase, $".skip({scope.ToString().ToLower()},{itemsToSkip})"));
 }
 public static GremlinQuery Range(this GremlinQuery queryBase, GraphScope scope, int itemsToSkip, int itemsToInclude)
 {
     return(new ComposedGremlinQuery(queryBase, $".range({scope.ToString().ToLower()},{itemsToSkip},{itemsToInclude})"));
 }
Beispiel #22
0
 public override IEnumerator <Yield> Exec
     (Socket from, Socket to, GraphScope scope)
 {
     spawned = Instantiate(spawn);
     yield return(new SignalSocket(scope, GetSocket("execOut")));
 }
Beispiel #23
0
 public static GremlinQuery Limit(this GremlinQuery queryBase, GraphScope scope, int items)
 {
     return(new ComposedGremlinQuery(queryBase, $".limit({scope.ToString().ToLower()},{items})"));
 }
Beispiel #24
0
 public SignalSocket(GraphScope scope, Socket socket)
 {
     this.scope  = scope;
     this.socket = socket;
 }
Beispiel #25
0
 public override void Eval(GraphScope scope)
 {
     result = Mathf.SmoothStep(a, b, t);
 }
Beispiel #26
0
 public override IEnumerator <Yield> Exec
     (Socket from, Socket to, GraphScope scope)
 {
     behaviour.enabled = enable;
     yield return(new SignalSocket(scope, GetSocket("execOut")));
 }
Beispiel #27
0
 public override void Eval(GraphScope scope)
 {
     result = l - r;
 }
Beispiel #28
0
 public override void Eval(GraphScope scope)
 {
     result = Mathf.Log(f, p);
 }
Beispiel #29
0
 public override void Eval(GraphScope scope)
 {
     result = Mathf.Tan(f);
 }
Beispiel #30
0
 public override void Eval(GraphScope scope)
 {
     result = Mathf.Atan2(y, x);
 }