コード例 #1
0
ファイル: Blueprint.cs プロジェクト: mainettis/Blueprints
        protected internal bool ShouldLinkWith(IntVec3 position, ThingDef thingDef)
        {
            // get things at neighbouring position
            var thingsAtPosition = AvailableContents
                                   .Where(item => item.Position == position && item.BuildableDef is ThingDef)
                                   .Select(item => item.BuildableDef as ThingDef);

            // if there's nothing there, there's nothing to link with
            if (!thingsAtPosition.Any())
            {
                return(false);
            }

            // loop over things to see if any of the things at the neighbouring location share a linkFlag with the thingDef we're looking at
            foreach (var thing in thingsAtPosition)
            {
                if ((thing.graphicData.linkFlags & thingDef.graphicData.linkFlags) != LinkFlags.None)
                {
                    return(true);
                }
            }

            // nothing stuck, return false
            return(false);
        }
コード例 #2
0
        public void Debug()
        {
            Log.Message(_size.ToString());

            foreach (BuildableInfo thing in contents)
            {
                Log.Message(thing.ToString());
                Log.Message($"Available: {AvailableContents.Contains(thing)}");
            }
        }