Ejemplo n.º 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));
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void OnEventBattle(EventBattle evt)
 {
     if (evt.action == EventBattle.Action.GET_COIN)
     {
         Coin.CreateGroup(evt.position, coinTransform.GetUIPos(), evt.count);
         coinText.text = D.I.battleGetCoin.KMB();
     }
 }
Ejemplo n.º 3
0
 public static EventBattle Get(Action action, int count, Vector2 position)
 {
     if (sIns == null)
     {
         sIns = new EventBattle();
     }
     sIns.action   = action;
     sIns.count    = count;
     sIns.position = position;
     return(sIns);
 }