Example #1
0
    private void Start()
    {
        _started = true;
        DebugLog("Service prefab Instantiated.");
        ApplyBugFixes();
        //DestroyImmediate(GetComponent<KMService>()); //Hide from Mod Selector
        _modSettings = new Settings(GetComponent <KMModSettings>());

        if (!Initialize())
        {
            DebugLog("Failed to initialize the reflection component of Vanilla Rule Modifier. Aborting load");
            return;
        }
        if (!_modSettings.ReadSettings())
        {
            DebugLog("Failed to initialize Mod settings. Aborting load");
            return;
        }

        GameObject infoObject = new GameObject("VanillaRuleModifierProperties");

        infoObject.transform.parent            = gameObject.transform;
        PublicProperties[0]                    = infoObject.AddComponent <RuleSeedModifierProperties>();
        PublicProperties[0].VanillaRuleModifer = this;

        GameObject infoObject2 = new GameObject("RuleSeedModifierProperties");

        infoObject2.transform.parent           = gameObject.transform;
        PublicProperties[1]                    = infoObject2.AddComponent <RuleSeedModifierProperties>();
        PublicProperties[1].VanillaRuleModifer = this;

        foreach (string mod in ModsThatSupportRuleSeedModifier)
        {
            RuleSeedModifierProperties.AddSupportedModule(mod);
        }

        _gameInfo = GetComponent <KMGameInfo>();
        LoadMod();

        DebugLog("Service started");
    }