コード例 #1
0
        public static Thing GetAttachment(this Thing t, ThingDef def)
        {
            CompAttachBase compAttachBase = t.TryGetComp <CompAttachBase>();

            if (compAttachBase == null)
            {
                return(null);
            }
            return(compAttachBase.GetAttachment(def));
        }
コード例 #2
0
        public virtual void AttachTo(Thing parent)
        {
            this.parent = parent;
            CompAttachBase compAttachBase = parent.TryGetComp <CompAttachBase>();

            if (compAttachBase == null)
            {
                Log.Error("Cannot attach " + this + " to " + parent + ": parent has no CompAttachBase.");
            }
            else
            {
                compAttachBase.AddAttachment(this);
            }
        }
コード例 #3
0
        public virtual void AttachTo(Thing parent)
        {
            this.parent = parent;
            CompAttachBase compAttachBase = parent.TryGetComp <CompAttachBase>();

            if (compAttachBase == null)
            {
                Log.Error(string.Concat("Cannot attach ", this, " to ", parent, ": parent has no CompAttachBase."));
            }
            else
            {
                compAttachBase.AddAttachment(this);
            }
        }
コード例 #4
0
        public static Thing GetAttachment(this Thing t, ThingDef def)
        {
            CompAttachBase compAttachBase = t.TryGetComp <CompAttachBase>();
            Thing          result;

            if (compAttachBase == null)
            {
                result = null;
            }
            else
            {
                result = compAttachBase.GetAttachment(def);
            }
            return(result);
        }
コード例 #5
0
        public virtual void AttachTo(Thing parent)
        {
            this.parent = parent;
            CompAttachBase compAttachBase = parent.TryGetComp <CompAttachBase>();

            if (compAttachBase == null)
            {
                Log.Error(string.Concat(new object[]
                {
                    "Cannot attach ",
                    this,
                    " to ",
                    parent,
                    ": parent has no CompAttachBase."
                }), false);
                return;
            }
            compAttachBase.AddAttachment(this);
        }