示例#1
0
        public override Yield Execute(Rumor rumor)
        {
            bool call;

            try
            {
                // If there is no condition, this is an else and we will always
                // want to call
                if (Condition == null)
                {
                    call = true;
                }
                else
                {
                    var value = Condition.Evaluate(rumor.Scope)?.AsBoolean();
                    call = value?.Value ?? false;
                }
            }
            catch (UndefinedVariableException)
            {
                call = false;
            }
            catch (VariableTypeException)
            {
                call = false;
            }

            if (call)
            {
                rumor.Call(Label);
            }
            else
            {
                Next?.Execute(rumor);
            }

            return(null);
        }
示例#2
0
        public override void Update(Rumor rumor, double delta)
        {
            base.Update(rumor, delta);

            if (Timeout.HasValue)
            {
                Finished = Elapsed >= Timeout.Value;
                if (Finished)
                {
                    switch (moveType)
                    {
                    case MoveType.Jump:
                        rumor.Jump(label);
                        break;

                    case MoveType.Call:
                        rumor.Call(label);
                        break;
                    }
                    rumor.State.ClearChoices();
                }
            }
        }
示例#3
0
 public override Yield Execute(Rumor rumor)
 {
     rumor.Call(Label);
     return(null);
 }