Example #1
0
        private void Player2_ChangeScoreEvent(int score)
        {
            if (score - Player2.LifeScore < Consts.ScoreForLife)
            {
                return;
            }

            var life = Mathf.FloorToInt((float)score / Consts.ScoreForLife);

            Player2Life      += life;
            Player2.LifeScore = score;

            AudioManager.PlayMainSound(AudioPlayerLife);
        }
Example #2
0
        private IEnumerator NextLevelLoadScreen(EventHandler overlapScreen)
        {
            var defaultScale = Time.timeScale;

            Time.timeScale = 0;

            var loop  = true;
            var level = LevelManager.LevelNumber + 1;

            LoadLevelSceneController.Show(level, (s, e) => { loop = false; }, null);
            while (loop)
            {
                yield return(null);
            }

            if (overlapScreen != null)
            {
                overlapScreen(this, EventArgs.Empty);
            }

            yield return(new WaitForSecondsRealtime(1f));

            LevelManager.NextLevel();
            AudioManager.PlayMainSound(_instance.AudioStartLevel);
            yield return(new WaitForSecondsRealtime(1f));

            loop = true;
            LoadLevelSceneController.Hide((s, e) => { loop = false; });
            while (loop)
            {
                yield return(null);
            }

            Time.timeScale = defaultScale;
            SpawnPointEnemiesManager.StartSpawn();
            Player1.ResetEnemy();
            Player2.ResetEnemy();
        }
Example #3
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            if (other.tag == "Player" || other.tag == "Shield")
            {
                if (Type == Bonus.Life)
                {
                    AudioManager.PlayMainSound(AudioLife);
                }
                else
                {
                    AudioManager.PlayMainSound(AudioPickUp);
                }

                var obj = new GameObject(Sprite500Points.name);
                obj.transform.position = transform.position;
                var renderer = obj.AddComponent <SpriteRenderer>();
                renderer.sprite       = Sprite500Points;
                renderer.sortingOrder = 1;
                Destroy(obj, Consts.TimeDestroyObjectPoints);
                FieldController.Instance.AddOtherObject(obj);

                Destroy(gameObject);
            }
        }