Exemple #1
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            var coin = other.GetComponent <Coin>();

            if (coin != null)
            {
                GameplayController.IncreaseSoftCurrency();
                coin.Disappear();
            }

            var ammoRefill = other.GetComponent <AmmoRefill>();

            if (ammoRefill != null)
            {
                GameplayController.BonusAmmo();
                ammoRefill.Disappear();
            }

            var jetpack = other.GetComponent <Jetpack>();

            if (jetpack != null)
            {
                jetpack.Disappear();
                GameplayController.JetpackCollected.Invoke();
            }
        }
Exemple #2
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            var coin = other.GetComponent <Coin>();

            if (coin != null)
            {
                GameplayController.IncreaseSoftCurrency();
                coin.Disappear();
                return;
            }

            var ammoRefill = other.GetComponent <AmmoRefill>();

            if (ammoRefill != null)
            {
                if (!ammoRefill.Consumed)
                {
                    ammoRefill.Consumed = true;
                    ammoRefill.Disappear();
                    GameplayController.BonusAmmo();
                    return;
                }
            }

            var jetpack = other.GetComponent <Jetpack>();

            if (jetpack != null)
            {
                jetpack.Disappear();
                GameplayController.JetpackCollected.Invoke();
                return;
            }

            var scoreIndicator = other.GetComponent <ScoreIndicatorPresenter>();

            if (scoreIndicator != null)
            {
                scoreIndicator.Highlight();
            }
        }