コード例 #1
0
        public static MappedItem Map(GameObject prefab)
        {
            if (prefab == null)
            {
                throw new ArgumentException("The prefab was NULL.");
            }

            ModComponent modComponent = ModUtils.GetModComponent(prefab);

            if (modComponent == null)
            {
                throw new ArgumentException("Prefab " + prefab.name + " does not contain a ModComponent.");
            }

            if (prefab.GetComponent <GearItem>() == null)
            {
                Implementation.Log("Mapping {0}", prefab.name);

                InspectMapper.Configure(modComponent);
                HarvestableMapper.Configure(modComponent);
                RepairableMapper.Configure(modComponent);
                FireStarterMapper.Configure(modComponent);
                ConfigureAccelerant(modComponent);
                ConfigureStackable(modComponent);
                ConfigureBurnable(modComponent);
                ScentMapper.Configure(modComponent);
                SharpenableMapper.Configure(modComponent);
                EvolveMapper.Configure(modComponent);

                ConfigureEquippable(modComponent);
                ConfigureLiquidItem(modComponent);
                ConfigureFood(modComponent);
                CookableMapper.Configure(modComponent);
                ConfigureCookingPot(modComponent);
                ConfigureRifle(modComponent);
                ClothingMapper.ConfigureClothing(modComponent);
                FirstAidMapper.Configure(modComponent);
                ToolMapper.Configure(modComponent);
                BedMapper.Configure(modComponent);

                ConfigureGearItem(modComponent);

                mappedItems.Add(modComponent);

                PostProcess(modComponent);
            }

            return(new MappedItem(prefab));
        }
コード例 #2
0
ファイル: Mapper.cs プロジェクト: ds5678/ModComponent
 internal static void ConfigureBehaviours(ModComponent modComponent)
 {
     AccelerantMapper.Configure(modComponent);
     BurnableMapper.Configure(modComponent);
     FireStarterMapper.Configure(modComponent);
     TinderMapper.Configure(modComponent);
     CarryingCapacityMapper.Configure(modComponent);
     EvolveMapper.Configure(modComponent);
     HarvestableMapper.Configure(modComponent);
     MillableMapper.Configure(modComponent);
     RepairableMapper.Configure(modComponent);
     ScentMapper.Configure(modComponent);
     SharpenableMapper.Configure(modComponent);
     StackableMapper.Configure(modComponent);
 }
コード例 #3
0
        private static void ConfigureGearItem(ModComponent modComponent)
        {
            GearItem gearItem = ModUtils.GetOrCreateComponent <GearItem>(modComponent);

            gearItem.m_Type         = GetGearType(modComponent);
            gearItem.m_WeightKG     = modComponent.WeightKG;
            gearItem.m_MaxHP        = modComponent.MaxHP;
            gearItem.m_DailyHPDecay = GetDecayPerStep(modComponent.DaysToDecay, modComponent.MaxHP);
            gearItem.OverrideGearCondition(ModUtils.TranslateEnumValue <GearStartCondition, InitialCondition>(modComponent.InitialCondition));

            gearItem.m_LocalizedDisplayName = CreateLocalizedString(modComponent.DisplayNameLocalizationId);
            gearItem.m_LocalizedDescription = CreateLocalizedString(modComponent.DescriptionLocalizatonId);

            gearItem.m_PickUpAudio  = modComponent.PickUpAudio;
            gearItem.m_StowAudio    = modComponent.StowAudio;
            gearItem.m_PutBackAudio = modComponent.PickUpAudio;
            gearItem.m_WornOutAudio = modComponent.WornOutAudio;

            gearItem.m_ConditionTableType = GetConditionTableType(modComponent);
            gearItem.m_ScentIntensity     = ScentMapper.GetScentIntensity(modComponent);

            gearItem.Awake();
        }
コード例 #4
0
ファイル: Mapper.cs プロジェクト: ds5678/ModComponent
        private static void ConfigureGearItem(ModComponent modComponent)
        {
            GearItem gearItem = ComponentUtils.GetOrCreateComponent <GearItem>(modComponent);

            gearItem.m_Type         = GetGearType(modComponent);
            gearItem.m_WeightKG     = modComponent.WeightKG;
            gearItem.m_MaxHP        = modComponent.MaxHP;
            gearItem.m_DailyHPDecay = GetDecayPerStep(modComponent.DaysToDecay, modComponent.MaxHP);
            gearItem.OverrideGearCondition(EnumUtils.TranslateEnumValue <GearStartCondition, InitialCondition>(modComponent.InitialCondition), false);
            // OverrideGearCondition wanted to know if the item had been picked up yet; since Awake hadn't been called yet, I put false

            gearItem.m_LocalizedDisplayName = NameUtils.CreateLocalizedString(modComponent.DisplayNameLocalizationId);
            gearItem.m_LocalizedDescription = NameUtils.CreateLocalizedString(modComponent.DescriptionLocalizatonId);

            gearItem.m_PickUpAudio  = modComponent.PickUpAudio;
            gearItem.m_StowAudio    = modComponent.StowAudio;
            gearItem.m_PutBackAudio = modComponent.PickUpAudio;
            gearItem.m_WornOutAudio = modComponent.WornOutAudio;

            gearItem.m_ConditionTableType = GetConditionTableType(modComponent);
            gearItem.m_ScentIntensity     = ScentMapper.GetScentIntensity(modComponent);

            gearItem.Awake();
        }