Exemplo n.º 1
0
 public NullService()
 {
     if (instance_ == null)
     {
         instance_ = this;
     }
 }
Exemplo n.º 2
0
        // T is the interface ex IAudioService
        // if key not found, NullService
        public static T Get <T>(string key) where T : IGameService
        {
            if (m_Services.ContainsKey(key))
            {
                return((T)m_Services[key]);
            }
            Debug.Log($"Returning null service for {key}");
            NullService nullService = new NullService();

            return((T)nullService.GetInstance());
        }