Exemple #1
0
        private void OnEventVirus(EventVirus evt)
        {
            if (evt.action == EventVirus.Action.DEAD)
            {
                // add coin
                getCoin       += FormulaUtil.CoinConvert(evt.virus.size, mTableGameLevel.coinValueFactor * D.I.vipCoinValueMul, D.I.coinValue);
                mAddCoinCount += evt.virus.size * 0.1f;
                if (Random.value > CT.table.coinAddProb[evt.virus.size - 1])
                {
                    var pos       = UIUtil.GetUIPos(evt.virus.rectTransform);
                    int coinCount = Mathf.Clamp(Mathf.CeilToInt(mAddCoinCount), 1, 15);
                    Unibus.Dispatch(EventBattle.Get(EventBattle.Action.GET_COIN, coinCount, pos));
                    mAddCoinCount = 0;
                }

                // virus kills 4 buff
                D.I.kills4Buff += 1;

                // book
                D.I.BookAddCollectCount(evt.virus.id);
            }
            else if (evt.action == EventVirus.Action.BE_HIT)
            {
                if (BuffProxy.Ins.Has_Effect_Coin)
                {
                    var buff = BuffProxy.Ins.GetBuff("coin");
                    if (buff != null && Random.value <= buff.param2)
                    {
                        getCoin += FormulaUtil.CoinConvert(evt.virus.size, mTableGameLevel.coinValueFactor * buff.param1 * D.I.vipCoinValueMul, D.I.coinValue);
                        var pos = UIUtil.GetUIPos(evt.virus.rectTransform);
                        Unibus.Dispatch(EventBattle.Get(EventBattle.Action.GET_COIN, 1, pos));
                    }
                }
            }
        }
Exemple #2
0
 private void BeHit(float damage)
 {
     PlayHurt();
     Knockback();
     BeHitSlowDown();
     Unibus.Dispatch(EventVirus.Get(EventVirus.Action.BE_HIT, this, damage));
 }
Exemple #3
0
 private void OnEventVirus(EventVirus evt)
 {
     if (evt.action == EventVirus.Action.DEAD &&
         TimeUtil.CheckInterval("BackgroundShake", 0.1f))
     {
         shakeRoot.DOShakeAnchorPos(0.1f, CT.table.virusBombShakeScreenRate);
     }
 }
Exemple #4
0
 private void BeDead()
 {
     isAlive = false;
     Unibus.Dispatch(EventVirus.Get(EventVirus.Action.DEAD, this, hpTotal));
     Recycle();
     PlayDead();
     Divide();
     GenBuff();
 }
 public static EventVirus Get(Action action, VirusBase virus, float value)
 {
     if (sIns == null)
     {
         sIns = new EventVirus();
     }
     sIns.action = action;
     sIns.virus  = virus;
     sIns.value  = value;
     return(sIns);
 }