Esempio n. 1
0
    void PlayerGainScore(int val, Collider2D other, BulletManager.GroupIndex groupType)
    {
        int finalValue = 0;

        if (other.tag == TagManager.sSingleton.player1BulletTag)
        {
            if (groupType == BulletManager.GroupIndex.PLAYER_MAIN)
            {
                mPlayer1Controller.UpdateLinkBar();
            }
            else
            {
                mPlayer1Controller.UpdateLinkBarForSecondary();
            }

            finalValue = (int)(val * mPlayer1Controller.scoreMult);
            mPlayer1Controller.UpdateScore(finalValue);
        }
        else if (other.tag == TagManager.sSingleton.player2BulletTag)
        {
            if (groupType == BulletManager.GroupIndex.PLAYER_MAIN)
            {
                mPlayer2Controller.UpdateLinkBar();
            }
            else
            {
                mPlayer2Controller.UpdateLinkBarForSecondary();
            }

            finalValue = (int)(val * mPlayer2Controller.scoreMult);
            mPlayer2Controller.UpdateScore(finalValue);
        }
        else if (other.tag == TagManager.sSingleton.magnumRadTag)
        {
            int playerID = other.GetComponent <DamageWithinRadius> ().playerID;

            if (playerID == 1)
            {
                mPlayer1Controller.UpdateLinkBar();

                finalValue = (int)(val * mPlayer1Controller.scoreMult);
                mPlayer1Controller.UpdateScore(finalValue);
            }
            else if (playerID == 2)
            {
                mPlayer2Controller.UpdateLinkBar();

                finalValue = (int)(val * mPlayer2Controller.scoreMult);
                mPlayer2Controller.UpdateScore(finalValue);
            }
        }
    }
Esempio n. 2
0
    void GetDamaged(float damagedValue, Collider2D other, BulletManager.GroupIndex groupType)
    {
        float scoreGet = damagedValue * scoreMultiplier;

        currHitPoint -= damagedValue;

        ParticleSystem ps  = EnvObjManager.sSingleton.GetEnemyHitImpactPS();
        Vector3        pos = other.gameObject.GetComponent <Collider2D>().bounds.ClosestPoint(transform.position);

        BulletMove bulletMove = other.GetComponent <BulletMove>();

        if ((bulletMove != null && bulletMove.GetIsPiercing()) || other.GetComponent <Laser>() != null)
        {
            PlayEnemyGetHitImpactPS(ps, pos, true);
        }
        else
        {
            PlayEnemyGetHitImpactPS(ps, pos, false);
        }

        if (!mIsChangeColor)
        {
            StartCoroutine(GetDamagedColorChange());
        }
        if (currHitPoint <= 0)
        {
            if (isBoss)
            {
                BulletManager.sSingleton.TransformEnemyBulsIntoScorePU();
                BulletManager.sSingleton.DisableEnemyBullets(false);
                UIManager.sSingleton.DeactivateBossTimer();
                EnemyManager.sSingleton.isBossDead = true;

                if (isEndShakeScreen)
                {
                    CameraShake.sSingleton.ShakeCamera();
                }
                if (AudioManager.sSingleton != null)
                {
                    AudioManager.sSingleton.PlayBossExplodeSfx();
                }
            }
            else if (mItemDropController != null)
            {
                mItemDropController.ItemDropFunc();
            }

            if (mIsMarkedByMagnum)
            {
                Transform magnumRad = EnvObjManager.sSingleton.GetMagnumRadius();
                magnumRad.position = transform.position;
                magnumRad.gameObject.SetActive(true);

                mMagnumTimer      = 0;
                mIsMarkedByMagnum = false;
            }

            if (other.tag == TagManager.sSingleton.player1BulletTag)
            {
                mPlayer1Controller.UpdateMultiplier(defeatedMult);
            }
            else if (other.tag == TagManager.sSingleton.player2BulletTag)
            {
                mPlayer2Controller.UpdateMultiplier(defeatedMult);
            }
            else if (other.tag == TagManager.sSingleton.magnumRadTag)
            {
                int playerID = other.GetComponent <DamageWithinRadius> ().playerID;
                if (playerID == 1)
                {
                    mPlayer1Controller.UpdateMultiplier(defeatedMult);
                }
                else if (playerID == 2)
                {
                    mPlayer2Controller.UpdateMultiplier(defeatedMult);
                }
            }

            scoreGet  = (currHitPoint + damagedValue) * scoreMultiplier;
            scoreGet += defeatedScore;

            Transform trans = EnvObjManager.sSingleton.GetKillScore();
            trans.GetComponent <Text> ().text = defeatedScore.ToString();
            trans.position = transform.position;
            trans.gameObject.SetActive(true);

            PlayEnemyDeathPS();
            gameObject.SetActive(false);
        }

        PlayerGainScore((int)scoreGet, other, groupType);
    }