Пример #1
0
        public override IEnumerator Run(InstructionGraph graph, InstructionStore variables, int iteration)
        {
            if (ResolveObject <AnimationPlayer>(variables, AnimationPlayer, out var player))
            {
                if (ResolveObject(variables, Animation, out var animation))
                {
                    if (WaitForCompletion)
                    {
                        yield return(player.PlayAnimationAndWait(animation));
                    }
                    else
                    {
                        player.PlayAnimation(animation);
                    }
                }
            }

            graph.GoTo(Next, nameof(Next));
        }
Пример #2
0
        protected override IEnumerator Run_(InstructionGraph graph, InstructionStore variables, int iteration)
        {
            if (variables.This is Animator animator)
            {
                if (State.TryGetValue(variables, this, out var state))
                {
                    animator.Play(state);
                }
                else
                {
                    Debug.LogWarningFormat(this, _stateNotFoundWarning, Name);
                }
            }
            else
            {
                Debug.LogWarningFormat(this, _animatorNotFoundWarning, Name);
            }

            graph.GoTo(Next, variables.This, nameof(Next));

            yield break;
        }
        public override IEnumerator Run(InstructionGraph graph, InstructionStore variables, int iteration)
        {
            Type type;

            try
            {
                type = Type.GetType(ScriptableObjectType, false);                 // still throws in some cases
            }
            catch
            {
                type = null;
            }

            if (type != null)
            {
                var obj = CreateInstance(type);

                if (obj != null)
                {
                    if (ObjectVariable.IsAssigned)
                    {
                        Assign(variables, ObjectVariable, VariableValue.Create(obj));
                    }
                }
                else
                {
                    Debug.LogErrorFormat(this, _invalidObjectError, Name, ScriptableObjectType);
                }
            }
            else
            {
                Debug.LogErrorFormat(this, _invalidTypeError, Name, ScriptableObjectType);
            }

            graph.GoTo(Next, nameof(Next));

            yield break;
        }
Пример #4
0
        protected override IEnumerator Run_(InstructionGraph graph, InstructionStore variables, int iteration)
        {
            var control = Control.GetControl <InterfaceControl>(this);

            _status.Reset();

            if (control)
            {
                control.UpdateBindings(variables, Group, _status);
            }

            if (WaitForCompletion)
            {
                while (!_status.IsFinished())
                {
                    yield return(null);
                }
            }

            graph.GoTo(Next, variables.This, nameof(Next));

            yield break;
        }
Пример #5
0
        public override IEnumerator Run(InstructionGraph graph, InstructionStore variables, int iteration)
        {
            if (ResolveObject(variables, AudioPlayer, out AudioPlayer player))
            {
                if (ResolveObject(variables, Sound, out var sound))
                {
                    if (!Resolve(variables, Volume, out var volume))
                    {
                        volume = 1.0f;
                    }

                    if (WaitForCompletion)
                    {
                        yield return(player.PlaySoundAndWait(sound, volume));
                    }
                    else
                    {
                        player.PlaySound(sound, volume);
                    }
                }
            }

            graph.GoTo(Next, nameof(Next));
        }
Пример #6
0
 public override IEnumerator Run(InstructionGraph graph, InstructionStore variables, int iteration)
 {
     Expression.Execute(this, variables);
     graph.GoTo(Next, nameof(Next));
     yield break;
 }
Пример #7
0
 protected override IEnumerator Run_(InstructionGraph graph, InstructionStore variables, int iteration)
 {
     Control.Activate(this);
     graph.GoTo(Next, variables.This, nameof(Next));
     yield break;
 }
Пример #8
0
        public override IEnumerator Run(InstructionGraph graph, InstructionStore variables, int iteration)
        {
            yield return(null);

            graph.GoTo(Next, nameof(Next));
        }