示例#1
0
 public override void Calculate()
 {
     if (Outputs.Count == 1 && Inputs.All(i => i.State.HasValue))
     {
         Outputs.First().State = (Inputs.Count < 2) ? false : Inputs.All(i => (bool)i.State == true);
     }
 }
示例#2
0
 public override void Calculate()
 {
     if (Outputs.Count == 1 && Inputs.All(i => i.State.HasValue))
     {
         Outputs.First().State = Inputs.Count < 2 ? false : !Inputs.All(i => i.State == false);
     }
 }
示例#3
0
        protected DigitalLevel OrFunction()
        {
            if (Inputs.All((c) => c.Level == DigitalLevel.Low))
            {
                return(DigitalLevel.Low);
            }

            return(DigitalLevel.High);
        }
示例#4
0
 public override void Calculate()
 {
     if (Inputs.Count > 0 && (Inputs.Count == Outputs.Count) && Inputs.All(i => i.State.HasValue))
     {
         for (int i = 0; i < Inputs.Count; i++)
         {
             Outputs[i].State = Inputs[i].State;
         }
     }
 }
示例#5
0
        public override IList <string> GetColumnTypes()
        {
            if (Inputs.All(i => InputDict.ContainsKey(i)))
            {
                var input1 = InputDict[Inputs[0]];
                var input2 = InputDict[Inputs[1]];

                var result = new List <string>();
                result.AddRange(input1.GetColumnTypes().Select(c => c));
                result.AddRange(input2.GetColumnTypes().Select(c => c));
                return(result);
            }
            else
            {
                return(new List <string>());
            }
        }
示例#6
0
        private bool MethodFinder(MethodBase methodInfo, Type parameterType)
        {
            var parameters = methodInfo.GetParameters()
                             .Where(pi => pi.Name != OutPrefix + BegIdxParam && pi.Name != OutPrefix + NbElementParam)
                             .ToList();

            var inParameters = parameters.Where(pi => pi.Name.StartsWith(InPrefix) && pi.ParameterType == parameterType)
                               .Select(pi => pi.Name);
            var outParameters = parameters
                                .Where(pi => pi.Name.StartsWith(OutPrefix) && (pi.ParameterType == parameterType || pi.ParameterType == typeof(int[])))
                                .Select(pi => pi.Name);
            var optInParameters = parameters.Where(pi => pi.Name.StartsWith(OptInPrefix)).Select(pi => pi.Name);

            var defInParameters = Inputs.Length > 1 && Inputs.All(p => p == GeneralRealParam)
                ? Inputs.Select((p, i) => InPrefix + p + i)
                : Inputs.Select(p => InPrefix + p);
            var defOutParameters   = Outputs.Select(NormalizeOutputParameter);
            var defOptInParameters = Options.Select(NormalizeOptionalParameter);

            return(methodInfo.Name == Name && inParameters.SequenceEqual(defInParameters) &&
                   outParameters.SequenceEqual(defOutParameters) && optInParameters.SequenceEqual(defOptInParameters));
        }
示例#7
0
文件: Node.cs 项目: foxor/LD41
    public IEnumerator Activate()
    {
        bool isLast = Inputs.All(x => x.IsActive);

        while (!Inputs.All(x => x.IsActive))
        {
            yield return(null);
        }
        if (isLast)
        {
            ActiveRefCount++;
            yield return(TimingController.Instance.WaitAppropriately(Duration));

            if (Duration != TimeCategory.Math)
            {
                SFXPlayer.PlaySound("ActivateNode");
            }
            yield return(ActivateInner());

            ActiveRefCount--;
        }
    }
示例#8
0
 protected override void CalculateOutput()
 {
     output = Inputs.All(x => x.Value);
 }
示例#9
0
 protected override bool Check()
 {
     return(Inputs.All(c => c.IsActive));
 }
示例#10
0
 public override bool Eval(Dictionary <char, bool> values)
 {
     return(Inputs.All(g => g.Eval(values)));
 }
示例#11
0
 public override bool Output() =>
 Inputs.All(input => input.Output());