public T GetView <T>() where T : View { foreach (var view in _views) { if (view is T) { return(view as T); } } ConditionalLogger.LogError($"Cant get <color=red><b> {typeof(T).Name}</b></color>"); return(null); }
void IEventListenerSystem <StartGameEvent> .OnEvent(StartGameEvent contextEvent) { _levelView = context.GetView <LevelView>(); if (_levelView == null) { ConditionalLogger.LogError("Fatal error because there is no level view!"); return; } _spawnAreaView = context.GetView <SpawnAreaView>(); _spawnAreaBounds = _spawnAreaView.Collider.bounds; ConditionalLogger.Log($"Bounds of level {_levelView.gameObject.name} is {_spawnAreaBounds.size}"); StartSpawn(); }
protected List <string> GetPublicMethodNames() { List <string> method_names; try { var method_info_array = GetType().GetMethods(ParseFlags); method_names = method_info_array.Select(x => x.Name).ToList(); method_names.Remove(".ctor"); method_names.RemoveAll(x => x.StartsWith("set_") || x.StartsWith("get_")); } catch (Exception e) { ConditionalLogger.LogError($"<b>LoggerFuncs.MethodInfo</b> Exception msg:{e.Message} stack: {e.StackTrace}"); method_names = m_functions; } return(method_names); }