示例#1
0
    private void OnDead()
    {
        if (IsDead)
        {
            return;
        }
        IsDead = true;

        //音效
        Sound.PlayUiAudioOneShot(Deploy.deadSound);

        //特效
        EffectFactory.PlayEffectOnce(Deploy.deadEffect, transform.position);

        //播放shader特效
        StageCamera2D.Instance.PlayDeadEffect(transform.position);

        //销毁僚机
        SupportMgr.Clear();

        //销毁自己
        Destroy(gameObject);

        //发事件
        GameEventCenter.Send(GameEvent.OnPlayerDead);

        //销毁子弹
        BulletExplosion.Create(transform.position, 0.3f);
    }
示例#2
0
    private void ChangeToNextCard()
    {
        //销毁当前Card
        var isFirstCard = true;

        if (_currCard != null)
        {
            //销毁子弹
            BulletExplosion.Create(Master.transform.position, 0.02f);

            //播放音效(success or failed)
            //todo
            Sound.PlayUiAudioOneShot(106);

            _currCard.OnDisable();
            _currCard.OnDestroy();
            _currCard   = null;
            isFirstCard = false;
        }

        //有剩余符卡,切换到下一个
        if (_cardList.Count > 0)
        {
            _currCard = _cardList[0];
            _cardList.RemoveAt(0);
            _currCard.OnEnable(isFirstCard);
            _cardStartTime = Time.time;


            //播放收缩or扩大特效
            if (!isFirstCard)
            {
                if (_currCard.Phase == EBossCardPhase.Two)
                {
                    Master.PlayShirnkEffect();
                }
                else
                {
                    Master.PlayShirnkEffect(true);
                }
            }
        }
        else
        {
            //所有符卡用完了,直接死亡
            Master.SelfDie();
        }
    }