/// <summary> /// Method to show popup(screen), at same time it is Initialise popup method /// </summary> /// <param name="obj"></param> public void Show(object obj = null) { PoolManager = InjectBox.Get <PoolManager>(); PopupManager = InjectBox.Get <PopupManager>(); OnShow(obj); }
public void InitArrow(Transform target, int damage) { _poolManager = InjectBox.Get <PoolManager>(); _target = target; _direction = _target.position - transform.position; _damage = damage; }
public void OnAwake() { try { _uiParent = GameObject.Find("UI_Canvas").GetComponent <Transform>(); } catch (NullReferenceException e) { var eventSystemGo = new GameObject("EventSystem"); eventSystemGo.AddComponent <EventSystem>(); eventSystemGo.AddComponent <StandaloneInputModule>(); var canvasGo = new GameObject("UI_Canvas"); var canvas = canvasGo.AddComponent <Canvas>(); var scaler = canvasGo.AddComponent <CanvasScaler>(); canvasGo.AddComponent <GraphicRaycaster>(); canvas.renderMode = RenderMode.ScreenSpaceOverlay; scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize; scaler.referenceResolution = new Vector2(1080.0f, 1920.0f); _uiParent = canvasGo.transform; } _poolManager = InjectBox.Get <PoolManager>(); }
public TetraminoBuilder() { _cubePrefab = Resources.Load <GameObject>("Prefabs/SceneItems/Cube/Cube"); _parentChest = GameObject.Find("Chest").GetComponent <Transform>(); _poolManager = InjectBox.Get <PoolManager>(); _tetraminoData = InjectBox.Get <TetraminoData>(); }
private void Start() { if (EventManager == null) { EventManager = InjectBox.Get <EventManager>(); } OnStart(); }
private void Start() { _levelManager = InjectBox.Get <LevelManager>(); _poolManager = InjectBox.Get <PoolManager>(); _animator = GetComponent <Animator>(); EventManager.Subscribe <OnGameOverEvent>(OnGameOver); }
/// <summary> /// Method the same as SceneManager.LoadScene() but with ability to adjust InjectBox, clear resources and call garbage collector. /// </summary> /// <param name="stageId"></param> /// <param name="mode"></param> public static void LoadStage(StageID stageId, LoadSceneMode mode = LoadSceneMode.Single) { InjectBox.ClearNonGlobalInjectables(); InjectBox.Get <PoolManager>().ClearPools(); EventManager.UnsubscribeAllEvents(); SceneManager.LoadScene(stageId.ToString(), mode); Resources.UnloadUnusedAssets(); GC.Collect(); }
public void OnAwake() { _popupManager = InjectBox.Get <PopupManager>(); _fortressController = new FortressController(); _enemyController = new EnemyController(); _monoBehaviour = GameObject.Find("[EnterPoint]").GetComponent <LevelManagerMonoBehaviour>(); _monoBehaviour.SetUp(this); _enemies = new List <Enemy>(); }
private void DeleteLine(int i) { for (int j = 0; j < TetraminoController.Width; j++) { InjectBox.Get <PoolManager>().GetPool <Cube>().Deactivate(TetraminoController.Grid[j, i]); EventManager.TriggerEvent <OnScoreGainedEvent>(); TetraminoController.Grid[j, i] = null; } }
public void OnAwake() { _itemData = InjectBox.Get <ItemData>(); _levelData = InjectBox.Get <LevelData>(); _popupManager = InjectBox.Get <PopupManager>(); _gridController = new GridController(); _environmentItemsController = new EnvironmentItemsController(); }
private void Awake() { foreach (var inject in Injectables) { InjectBox.Add(inject); } InjectBox.InitializeStartInjectables(); }
public void OnActivate(object argument = default) { _levelManager = InjectBox.Get <LevelManager>(); _poolManager = InjectBox.Get <PoolManager>(); _animator = GetComponent <Animator>(); _currentHitpounts = _hitPoints; _direction = new Vector3(_speed, 0.0f, 0.0f); }
public EnvironmentItemsController() { _gameManager = InjectBox.Get <GameManager>(); _itemData = InjectBox.Get <ItemData>(); _levelData = InjectBox.Get <LevelData>(); _poolManager = InjectBox.Get <PoolManager>(); _itemModels = _itemData.ItemModels; _environmentParent = GameObject.Find("Environment").GetComponent <Transform>(); }
private void Awake() { foreach (var inject in Injectables) { InjectBox.Add(inject); } InjectBox.InitializeStartInjectables(); _monoEntities = FindObjectsOfType <MonoEntity>().ToList(); }
public GridController() { _gameManager = InjectBox.Get <GameManager>(); _levelData = InjectBox.Get <LevelData>(); _poolManager = InjectBox.Get <PoolManager>(); _cellPrefab = Resources.Load <GameObject>("Prefabs/Cell"); _gridParent = GameObject.Find("Grid").GetComponent <Transform>(); _cells = new List <Cell>(); _gridSize = _levelData.GetSize(_gameManager.CurrentLevel); }
public TetraminoController() { _spawner = new TetraminoSpawner(); _lineChecker = new TetraminoLineChecker(); _poolManager = InjectBox.Get <PoolManager>(); _chestParent = GameObject.Find("Chest").transform; _grid = new Cube[WIDTH, HEIGHT + 5]; _cubeParent = GameObject.Find(typeof(Cube) + "s").transform; _cubeParent.SetParent(_chestParent); EventManager.Subscribe <OnTetraminoFellEvent>(OnTetraminoFell); }
public void OnAwake() { _user = InjectBox.Get <GameManager>().GetCurrentUser(); _poolManager = InjectBox.Get <PoolManager>(); _popupManager = InjectBox.Get <PopupManager>(); _poolManager.PreLoad <Cube>(TetraminoController.Width * TetraminoController.Height); _tetraminoController = new TetraminoController(); EventManager.Subscribe <OnGameOverEvent>(OnGameOver); EventManager.Subscribe <OnRetryLevelEvent>(OnRetryLevel); EventManager.Subscribe <OnMenuEvent>(OnMenu); EventManager.Subscribe <OnCompleteLineEvent>(OnCompleteLine); }
protected override void OnShow(object obj = null) { _user = InjectBox.Get <GameManager>().GetCurrentUser(); _levelManager = InjectBox.Get <LevelManager>(); _speed = 1; UpdateScoresText(((int)obj).ToString()); UpdateSpeedText(_speed.ToString()); SetActiveBestText(); EventManager.Subscribe <OnTetraminoSpawnEvent>(OnTetraminoSpawn); EventManager.Subscribe <OnScoreGainedEvent>(OnScoreGained); EventManager.Subscribe <OnGameOverEvent>(OnGameOver); EventManager.Subscribe <OnIncreasedSpeedEvent>(OnIncreasedSpeed); }
private void OnTetraminoSpawn(OnTetraminoSpawnEvent obj) { UpdateNextTetraminoSprite(InjectBox.Get <TetraminoData>().GetIcon(obj.TetraminoId)); }
private void OnScoreGained(OnScoreGainedEvent obj) { UpdateScoresText(InjectBox.Get <GameManager>().GetCurrentUser().AddScore().ToString()); }
public void OnAwake() { _uiParent = GameObject.Find("UI").GetComponent <Transform>(); _poolManager = InjectBox.Get <PoolManager>(); }
private void Awake() { InjectBox.Add(_gameManager); InjectBox.Add(_userManager); InjectBox.Add(_poolManager); }
public void Release() { InjectBox.Get <PoolManager>().Release(gameObject.name, gameObject); }
public EnemyController() { _poolManager = InjectBox.Get <PoolManager>(); _enemyData = InjectBox.Get <EnemyData>(); _enemyModels = _enemyData.GetAllEnemyModels(); }
public FortressController() { _fortressPrefab = Resources.Load <GameObject>("Prefabs/Level/Fortress/Fortress"); _poolManager = InjectBox.Get <PoolManager>(); }
protected override void OnShow(object obj = null) { _gridController = InjectBox.Get <GameManager>().GetGridController(); }
public void OnAwake() { _popupManager = InjectBox.Get <PopupManager>(); }
private void OnApplicationQuit() { InjectBox.DisableAll(); }