Ejemplo n.º 1
0
        public void Fire()
        {
            PoolManager      pm = ManagerProvider.GetManager <PoolManager>();
            BulletController bc = pm.Spawn <BulletController>(PoolManager.EPool.Bullets, transform.position, transform.rotation);

            bc.Init(1, gameObject.layer);
        }
Ejemplo n.º 2
0
        public void GameOver()
        {
            TransitionManager tM = ManagerProvider.GetManager <TransitionManager>();

            tM.LoadSceneAdditiveAsync("GameOver");
            _gameOver = true;
        }
Ejemplo n.º 3
0
 public override bool IsConditionMeet()
 {
     if (_manager == null)
     {
         _manager = ManagerProvider.GetManager <GameManager>();
     }
     return(_manager.CurrentWave > _wavesToSurvive);
 }
Ejemplo n.º 4
0
 public override bool IsConditionMeet()
 {
     if (_manager == null)
     {
         _manager = ManagerProvider.GetManager <GameManager>();
     }
     return(_manager.TimePlayed >= _timeToSurvive);
 }
Ejemplo n.º 5
0
        private void SpawnEnemys(SpawnPatternData pattern)
        {
            PoolManager pm = ManagerProvider.GetManager <PoolManager>();

            foreach (var pos in pattern.Patterns)
            {
                pm.Spawn <EnemyController>(PoolManager.EPool.Enemy1, pos, Quaternion.Euler(0, 0, 180)).gameObject.SetActive(true);
            }
        }
Ejemplo n.º 6
0
        public override void Despawn()
        {
            PoolManager pm = ManagerProvider.GetManager <PoolManager>();

            pm.Despawn(PoolManager.EPool.Enemy1, gameObject);
            if (_givePoints)
            {
                ManagerProvider.GetManager <GameManager>().AddScore(_statsController.GetCurrentPoints());
            }
            //TODO: Add Explosion VFX
        }
Ejemplo n.º 7
0
        public void StartGame()
        {
            _timePlayed   = 0f;
            _score        = 0;
            _currentSpawn = 0;
            _currentWave  = 0;
            _nextSpawn    = 0;
            _isPaused     = false;
            _gameOver     = false;
            TransitionManager tM = ManagerProvider.GetManager <TransitionManager>();

            tM.LoadSceneAsync("Level1"); //not using Await due Fire and Forget
        }
Ejemplo n.º 8
0
        private void Start()
        {
            int highScore    = PlayerPrefs.HasKey("score") ? PlayerPrefs.GetInt("score"): 0;
            int currentScore = ManagerProvider.GetManager <GameManager>().CurrentScore;

            _highScoreLabel.text = (highScore > currentScore)?highScore.ToString(): currentScore.ToString();
            _scoreLabel.text     = currentScore.ToString();
            _exitBtn.onClick.AddListener(ExitGame);
            replayBtn.onClick.AddListener(Replay);
            _newRecord.SetActive(currentScore > highScore);
            if (currentScore > highScore)
            {
                PlayerPrefs.SetInt("score", currentScore);
            }
        }
Ejemplo n.º 9
0
        async void Start()
        {
            AsyncOperationHandle <GameObject> op = Addressables.LoadAssetAsync <GameObject>(_managers);
            await op.Task;

            op            = Addressables.InstantiateAsync(_managers);
            op.Completed += (obj) =>
            {
                DontDestroyOnLoad(obj.Result);
            };
            await op.Task;

            await ManagerProvider.InitializeManagers();

            GameManager gm = ManagerProvider.GetManager <GameManager>();

            gm.StartGame();
        }
Ejemplo n.º 10
0
        private async void Replay()
        {
            await ManagerProvider.GetManager <TransitionManager>().UnloadLastScene();

            ManagerProvider.GetManager <GameManager>().StartGame();
        }
Ejemplo n.º 11
0
        private void Despawn()
        {
            PoolManager pm = ManagerProvider.GetManager <PoolManager>();

            pm.Despawn(PoolManager.EPool.Bullets, gameObject);
        }
Ejemplo n.º 12
0
 private void Start()
 {
     _gManager = ManagerProvider.GetManager <GameManager>();
     GameManager.OnScoreUpdate += UpdateScore;
     _scoreLabel.text           = "Score: " + _gManager.CurrentScore.ToString();
 }
Ejemplo n.º 13
0
 public override void Despawn()
 {
     ManagerProvider.GetManager <GameManager>().GameOver();
 }