Abstract Factory Pattern for Implementing AdNetworks on Multiple Platforms
<p>Here's the <a href="https://github.com/usamaB/AdsSolution/tree/devel" rel="nofollow">link</a> to the github project. </p>

<p>I want to implement Abstract Factory instead of adding platform dependent compilation flags in just one file and make it ugly. Hence decoupled code. Moreover, I have to implement different AdNetworks on different platforms.</p>

<p>This is the interface</p>

<pre><code>public interface IAds 
{
    void ShowVideoAd();
    void PreLoadVideoAd();
    bool IsAdAvailable();

}
</code></pre>

<p>And all the PlatformAdController(Android, IOS, Amazon, Windows) will implement this interface. </p>

<pre><code>    public class AmazonAdsController : IAds
    {
// Code Goes here
    }
</code></pre>

<p>Then in <em>someFactoryClass</em> I'll do </p>

<pre><code>public IAds GetObject()
{
    #if UNITY_Android
    if(platform == Amazon)
    return new AmazonAdsController
    else 
    return new AndroidAdsController
    #elif UNITY_IOS
    return new IOSAdsController
    #elif UNITY_WP10
    return new WindowsAdsController
}
</code></pre>

<p>This Method will be called from AdManager a Singleton MonoBehaviour. My current AdManager state is</p>

<pre><code>namespace MS.Ads
{
    [RequireComponent(typeof(KeyGenerator))]
    public class AdManager : MonoBehaviour
    {
        #region Fields &amp; Properties
        [SerializeField]
        private KeysSource _keysSource;
        [SerializeField]
        [HideInInspector]
        private string _fileName;
        [SerializeField]
        [HideInInspector]
        private string _url;

        // Source from where to get keys
        public KeysSource Source
        {
            get { return _keysSource; }
            set { _keysSource = value; }
        }

        // Web URL from where to get AdKeys
        public string URL
        {
            get { return _url; }
            set { _url = value; }
        }

        // FileName from where to get Adkeys e.g adc.json
        public string FileName
        {
            get { return _fileName; }
            set { _fileName = value; }
        }

        // To be replaced by a FactoryObject.
        private FyberController _fyberController;
        #endregion

        #region Message Methods
        void Start()
        {            
            GetComponent&lt;KeyGenerator&gt;().GenerateKeys(Source, URL, FileName);
            _fyberController = new FyberController();
            _fyberController.RequestVideoAd();
        }
        #endregion

        #region Methods
        public void ShowAd()
        {
            if (_fyberController.IsVideoAdAvailable)
                _fyberController.ShowVideoAd();
        }

        public bool IsVideoAdAvailable()
        {
            return _fyberController.IsVideoAdAvailable ? true : false;
        }
        #endregion
    }
}
</code></pre>

<p>What I would like to know </p>

<ol>
<li>Is Factory Pattern the right choice here?</li>
<li>If yes, Should I go with an interface or an Abstract base class or a
base class with virtual methods?</li>
</ol>