コード例 #1
0
ファイル: MyNode.cs プロジェクト: codeaudit/BrainSimulator
        public virtual bool AcceptsConnection(MyNode fromNode, int fromIndex, int toIndex)
        {
            MyAbstractMemoryBlock outputBlock = fromNode.GetAbstractOutput(fromIndex);

            if (outputBlock != null && outputBlock.IsDynamic)
            {
                // TODO(HonzaS): Enable this later when variable count of dynamic memblocks is supported.
                if (toIndex >= GetInfo().InputBlocks.Count)
                {
                    return(false);
                }

                PropertyInfo inputBlock       = GetInfo().InputBlocks[toIndex];
                var          dynamicAttribute = inputBlock.GetCustomAttribute <DynamicBlockAttribute>();
                if (dynamicAttribute == null)
                {
                    return(false);
                }
            }

            return(true);
        }