Exemple #1
0
    /// <summary>
    /// Try and apply the SystemModifier to the SystemComponent.
    /// </summary>
    /// <returns>
    /// - ModuleResult.Success if the modifier was applied
    /// - ModuleResult.InvalidSystem if the SystemComponent wasn't found.
    /// </returns>
    public ModuleResult Apply()
    {
        // Try and get the component we will be modifying and apply the
        // modifier to it.
        SystemComponent comp = GetComponentInParent(_componentType) as SystemComponent;

        if (comp)
        {
            comp.ReplaceModifier(modifier);
            return(ModuleResult.Success);
        }
        else
        {
            Debug.LogError("[ModifierComponent] Failed to enable, SystemComponent[" + component + "] not found.");
            return(ModuleResult.InvalidSystem);
        }
    }