示例#1
0
    private IEnumerator ExeSpawnCoroutine(InputOperator input)
    {
        input.IsInControl = false;
        yield return(new WaitForSeconds(spawnTime));

        input.IsInControl = true;
    }
    public void Interact(CharacterController characterController)
    {
        _characterOperator = characterController.GetComponent <InputOperator>();
        if (hasCounterInteraction)
        {
            if (_interacted)
            {
                counterInteractionEvent?.Invoke(characterController);
            }
            else
            {
                interactionEvent?.Invoke(characterController);
            }
            _interacted = !_interacted;
            onTextChange?.Invoke();
        }
        else
        {
            interactionEvent?.Invoke(characterController);
            _interacted = true;
        }

        if (oneTime)
        {
            Disable();
        }
    }
        public override RawRecord Next()
        {
            RawRecord srcRecord = null;

            while (InputOperator.State() && (srcRecord = InputOperator.Next()) != null)
            {
                RawRecord result = DataModify(srcRecord);
                if (result == null)
                {
                    continue;
                }

                //foreach (var tuple in PropertiesToBeUpdated)
                //{
                //    var propertyIndex = tuple.Item3;
                //    var propertyNewValue = tuple.Item2;
                //    if (propertyIndex == -1) continue;

                //    srcRecord.fieldValues[propertyIndex] = new StringField(propertyNewValue.Value);
                //}

                return(srcRecord);
            }

            Close();
            return(null);
        }
示例#4
0
        internal override GremlinToSqlContext GetContext()
        {
            GremlinToSqlContext inputContext = InputOperator.GetContext();

            if (inputContext.PivotVariable == null)
            {
                throw new TranslationException("The PivotVariable of and()-step can't be null.");
            }

            List <GremlinToSqlContext> andContexts = new List <GremlinToSqlContext>();

            if (IsInfix)
            {
                FirstTraversal.GetStartOp().InheritedVariableFromParent(inputContext);
                andContexts.Add(FirstTraversal.GetEndOp().GetContext());

                SecondTraversal.GetStartOp().InheritedVariableFromParent(inputContext);
                andContexts.Add(SecondTraversal.GetEndOp().GetContext());
            }
            else
            {
                foreach (var andTraversal in AndTraversals)
                {
                    andTraversal.GetStartOp().InheritedVariableFromParent(inputContext);
                    andContexts.Add(andTraversal.GetEndOp().GetContext());
                }
            }

            inputContext.PivotVariable.And(inputContext, andContexts);

            return(inputContext);
        }
示例#5
0
        internal override GremlinToSqlContext GetContext()
        {
            GremlinToSqlContext inputContext = InputOperator.GetContext();

            if (inputContext.PivotVariable == null)
            {
                throw new QueryCompilationException("The PivotVariable can't be null.");
            }

            List <GremlinToSqlContext> orContexts = new List <GremlinToSqlContext>();

            if (IsInfix)
            {
                FirstTraversal.GetStartOp().InheritedVariableFromParent(inputContext);
                orContexts.Add(FirstTraversal.GetEndOp().GetContext());

                SecondTraversal.GetStartOp().InheritedVariableFromParent(inputContext);
                orContexts.Add(SecondTraversal.GetEndOp().GetContext());
            }
            else
            {
                foreach (var orTraversal in OrTraversals)
                {
                    orTraversal.GetStartOp().InheritedVariableFromParent(inputContext);
                    orContexts.Add(orTraversal.GetEndOp().GetContext());
                }
            }

            inputContext.PivotVariable.Or(inputContext, orContexts);

            return(inputContext);
        }
示例#6
0
 /// <summary>
 /// Returns the input operator as string.
 /// </summary>
 /// <param name="inputOperator">The input operator.</param>
 /// <returns>The textual representation of the input operator.</returns>
 public static string AsString(this InputOperator inputOperator)
 {
     return(inputOperator switch
     {
         InputOperator.Add => "+",
         InputOperator.Multiply => "*",
         InputOperator.Exponentiate => "^",
         _ => string.Empty
     });
示例#7
0
        /// <summary>
        /// Returns the input operator as string.
        /// </summary>
        /// <param name="inputOperator">The input operator.</param>
        /// <returns>The textual representation of the input operator.</returns>
        public static string AsString(this InputOperator inputOperator)
        {
            switch (inputOperator)
            {
            case InputOperator.Add: return("+");

            case InputOperator.Multiply: return("*");

            case InputOperator.Exponentiate: return("^");

            default: return(string.Empty);
            }
        }
        private static string OperatorAsString(InputOperator inputOperator)
        {
            switch (inputOperator)
            {
            case InputOperator.Add: return("+");

            case InputOperator.Multiply: return("*");

            case InputOperator.Exponentiate: return("^");
            }

            return(string.Empty);
        }
示例#9
0
        internal override GremlinToSqlContext GetContext()
        {
            GremlinToSqlContext inputContext = InputOperator.GetContext();

            List <GremlinToSqlContext> andContexts = new List <GremlinToSqlContext>();

            foreach (var orTraversal in OrTraversals)
            {
                orTraversal.GetStartOp().InheritedVariableFromParent(inputContext);
                andContexts.Add(orTraversal.GetEndOp().GetContext());
            }

            inputContext.PivotVariable.Or(inputContext, andContexts);

            return(inputContext);
        }
示例#10
0
        internal override GremlinToSqlContext GetContext()
        {
            GremlinToSqlContext inputContext = InputOperator.GetContext();

            if (inputContext.PivotVariable == null)
            {
                throw new QueryCompilationException("The PivotVariable can't be null.");
            }

            List <GremlinToSqlContext> andContexts = new List <GremlinToSqlContext>();

            foreach (var andTraversal in AndTraversals)
            {
                andTraversal.GetStartOp().InheritedVariableFromParent(inputContext);
                andContexts.Add(andTraversal.GetEndOp().GetContext());
            }
            inputContext.PivotVariable.And(inputContext, andContexts);

            return(inputContext);
        }
        public override RawRecord Next()
        {
            RawRecord srcRecord = null;

            while (InputOperator.State() && (srcRecord = InputOperator.Next()) != null)
            {
                RawRecord result = DataModify(srcRecord);
                if (result == null)
                {
                    continue;
                }

                //
                // Return the srcRecord
                //
                return(srcRecord);
            }

            Close();
            return(null);
        }
示例#12
0
        private AttributeRelationship CreateAttributeRelationship(AttributeDefinition targetAttribute, float multiplier, AttributeDefinition sourceAttribute, InputOperator inputOperator = InputOperator.Multiply)
        {
            var relationship = this.Context.CreateNew <AttributeRelationship>(targetAttribute.GetPersistent(this.GameConfiguration) ?? targetAttribute, multiplier, sourceAttribute.GetPersistent(this.GameConfiguration) ?? sourceAttribute, inputOperator);

            return(relationship);
        }
示例#13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AttributeRelationship" /> class.
 /// </summary>
 /// <param name="targetAttribute">The target attribute.</param>
 /// <param name="inputOperand">The multiplier.</param>
 /// <param name="inputAttribute">The input attribute.</param>
 /// <param name="inputOperator">The input operator.</param>
 public AttributeRelationship(AttributeDefinition targetAttribute, float inputOperand, AttributeDefinition inputAttribute, InputOperator inputOperator)
 {
     this.InputOperand    = inputOperand;
     this.InputOperator   = inputOperator;
     this.targetAttribute = targetAttribute;
     this.inputAttribute  = inputAttribute;
 }
        private AttributeRelationship CreateAttributeRelationship(AttributeDefinition targetAttribute, float multiplier, AttributeDefinition sourceAttribute, InputOperator inputOperator = InputOperator.Multiply)
        {
            var relationship = this.repositoryManager.CreateNew <AttributeRelationship>(this.gameConfiguration.Attributes.FirstOrDefault(a => a == targetAttribute) ?? targetAttribute, multiplier, this.gameConfiguration.Attributes.FirstOrDefault(a => a == sourceAttribute) ?? sourceAttribute, inputOperator);

            return(relationship);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AttributeRelationshipElement" /> class.
 /// </summary>
 /// <param name="inputElements">The input elements which are summed up.</param>
 /// <param name="inputOperand">The operand which is applied to the summed up input elements.</param>
 /// <param name="inputOperator">The input operator.</param>
 public AttributeRelationshipElement(IEnumerable <IElement> inputElements, float inputOperand, InputOperator inputOperator)
 {
     this.InputElements = inputElements;
     this.InputOperand  = inputOperand;
     this.InputOperator = inputOperator;
     foreach (var element in this.InputElements)
     {
         element.ValueChanged += this.ElementChanged;
     }
 }