コード例 #1
0
        public override void ExposeData(ObjectSerializer serializer)
        {
            // This is a temporary way to have spawnable hard-coded DroppedMechanismComponent prototypes
            // In the future (when it becomes possible) DroppedMechanismComponent should be auto-generated from
            // the Mechanism prototypes
            var debugLoadMechanismData = "";

            base.ExposeData(serializer);

            serializer.DataField(ref debugLoadMechanismData, "debugLoadMechanismData", "");

            if (serializer.Reading && debugLoadMechanismData != "")
            {
                _prototypeManager.TryIndex(debugLoadMechanismData !, out MechanismPrototype data);

                var mechanism = new Mechanism(data);
                mechanism.EnsureInitialize();

                InitializeDroppedMechanism(mechanism);
            }
        }