Esempio n. 1
0
    /// <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);
    }
Esempio n. 2
0
 public void InitArrow(Transform target, int damage)
 {
     _poolManager = InjectBox.Get <PoolManager>();
     _target      = target;
     _direction   = _target.position - transform.position;
     _damage      = damage;
 }
Esempio n. 3
0
    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>();
    }
Esempio n. 4
0
    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();
 }
Esempio n. 6
0
    private void Start()
    {
        _levelManager = InjectBox.Get <LevelManager>();
        _poolManager  = InjectBox.Get <PoolManager>();
        _animator     = GetComponent <Animator>();

        EventManager.Subscribe <OnGameOverEvent>(OnGameOver);
    }
Esempio n. 7
0
 /// <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();
 }
Esempio n. 8
0
 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;
     }
 }
Esempio n. 10
0
    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();
    }
Esempio n. 12
0
    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();
    }
Esempio n. 15
0
    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);
    }
Esempio n. 16
0
    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);
    }
Esempio n. 17
0
    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);
    }
Esempio n. 18
0
    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);
    }
Esempio n. 19
0
 private void OnTetraminoSpawn(OnTetraminoSpawnEvent obj)
 {
     UpdateNextTetraminoSprite(InjectBox.Get <TetraminoData>().GetIcon(obj.TetraminoId));
 }
Esempio n. 20
0
 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>();
 }
Esempio n. 22
0
 private void Awake()
 {
     InjectBox.Add(_gameManager);
     InjectBox.Add(_userManager);
     InjectBox.Add(_poolManager);
 }
Esempio n. 23
0
 public void Release()
 {
     InjectBox.Get <PoolManager>().Release(gameObject.name, gameObject);
 }
 public EnemyController()
 {
     _poolManager = InjectBox.Get <PoolManager>();
     _enemyData   = InjectBox.Get <EnemyData>();
     _enemyModels = _enemyData.GetAllEnemyModels();
 }
Esempio n. 25
0
 public FortressController()
 {
     _fortressPrefab = Resources.Load <GameObject>("Prefabs/Level/Fortress/Fortress");
     _poolManager    = InjectBox.Get <PoolManager>();
 }
Esempio n. 26
0
 protected override void OnShow(object obj = null)
 {
     _gridController = InjectBox.Get <GameManager>().GetGridController();
 }
Esempio n. 27
0
 public void OnAwake()
 {
     _popupManager = InjectBox.Get <PopupManager>();
 }
 private void OnApplicationQuit()
 {
     InjectBox.DisableAll();
 }