private void BeHit(float damage) { PlayHurt(); Knockback(); BeHitSlowDown(); Unibus.Dispatch(EventVirus.Get(EventVirus.Action.BE_HIT, this, damage)); }
private void OnCardClicked(CardDisplay card) { if (card.Placeholder.IsChildOf(this.transform)) { Unibus.Dispatch(PlayerTableDisplay.CARD_SELECTED_ON_TABLE, card); } }
public void EmmitCardToAimAction(UnitDisplay unit) { Unibus.Dispatch <SimpleAbilityCardAction>(ActionEmmiter.CARD_TO_AIM, new SimpleAbilityCardAction { cardId = unit.CardData.id }); }
public void CheckClickOutOfAnyCard() { if (!this.MouseOnDialog) { // Хоть убей я не придумал как сделать по другому. if (!this.skipedFirstCheckClickOutOfAnyCard) { this.skipedFirstCheckClickOutOfAnyCard = true; } else { var leftMouseClicked = Input.GetButtonDown("Fire1"); if (leftMouseClicked && MouseOnTile == false) { Unibus.Dispatch <string>(ClickOutOfBoardEmmiter.CLICK_OUT_OF_BOARD, ""); } var rightMouseClicked = Input.GetButtonDown("Fire2"); if (rightMouseClicked) { Unibus.Dispatch <string>(ClickOutOfBoardEmmiter.RIGHT_CLICK, ""); } } } }
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)); } } } }
public void EmmitCardUseManaAbilityAction(UnitDisplay unit) { Unibus.Dispatch <SimpleAbilityCardAction>(ActionEmmiter.CARD_USE_MANA_ABILITY, new SimpleAbilityCardAction { cardId = unit.CardData.id }); }
private void OnCardSelectedToPlayHandler(CardDisplay card) { if (card.Placeholder.IsChildOf(this.transform)) { Unibus.Dispatch(PlayerHandDisplay.CARD_SELECTED_TO_PLAY, card); } }
public void EmmitCardHealingAction(UnitDisplay healerUnit, UnitDisplay healedUnit) { Unibus.Dispatch <HealCardAction>(ActionEmmiter.CARD_HEAL, new HealCardAction { healerCardId = healerUnit.CardData.id, healedCardId = healedUnit.CardData.id }); }
public void HideDialog() { this.gameObject.SetActive(false); this.button1.GetComponent <Button>().onClick.RemoveListener(OnButton1ClickHandler); this.button2.GetComponent <Button>().onClick.RemoveListener(OnButton2ClickHandler); Unibus.Dispatch(DIALOG_MOUSE_EXIT, ""); }
private void KillUnit(CardDisplay cardDisplay) { cardDisplay.Kill(); this.playerStacks[cardDisplay.cardData.ownerId].graveyard.GetComponent <StackDisplay>().AddCard(cardDisplay); boardCreator.KillUnit(cardDisplay); Unibus.Dispatch(CardManager.CARD_DIED, cardDisplay); }
public void Kill() { this.cardData.alive = false; Unibus.Dispatch(CARD_DIED, this); this.ZoomOut(); this.Unselect(); this.OverHighlightOff(); }
public void EmmitCardPlayAction(CardDisplay card, Point point) { Unibus.Dispatch <PlayCardAction>(ActionEmmiter.CARD_PLAY, new PlayCardAction { cardId = card.cardData.id, x = point.x.ToString(), y = point.y.ToString() }); }
public void EmmitCardMoveAction(UnitDisplay movingUnit, Point point) { Unibus.Dispatch <MoveCardAction>(ActionEmmiter.CARD_MOVE, new MoveCardAction { cardId = movingUnit.CardData.id, x = point.x.ToString(), y = point.y.ToString() }); }
private void BeDead() { isAlive = false; Unibus.Dispatch(EventVirus.Get(EventVirus.Action.DEAD, this, hpTotal)); Recycle(); PlayDead(); Divide(); GenBuff(); }
void Start() { var count = 0; var button = this.GetComponent <Button>(); button.onClick.AddListener(() => Unibus.Dispatch(Tag, ++count)); // Initial rendering Unibus.Dispatch(Tag, count); }
private void OnActivateAbility(Ability ability) { var abilityActivated = new AbilityActivated() { cardDisplay = this.CardDisplay, ability = ability }; Unibus.Dispatch(ABILITY_ACTIVATED, abilityActivated); }
private void OnItemCollider(int index, VirusBase virus) { base.OnUnitFire(index); units[index].SetReady(false); Vector2 cDir = virus.position - units[index].position; Vector2 dir = (cDir + virus.direction).normalized; virus.SetDirection(dir); Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, virus, damage)); ExplosionWeaponCoverItem.Create().Reset(units[index].position, table.explosionSound); }
protected override void OnHit(VirusBase virus) { base.OnHit(virus); var hitPos = position + direction * 50; AreaHit(hitPos, effects[1] * 0.5f, (_vv) => { Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, _vv, damage)); }); ExplosionWeaponMissileBullet.Create().Reset(hitPos, effects[1], explosionSound); ForceRecycle(); }
private void CardWasInBattle(ServerActions.CardChanges cardChanges, bool isAttacker) { var cardTransform = cardIdToCards[cardChanges.id]; CardDisplay cardDisplay = cardTransform.GetComponent <CardDisplay>(); this.ApplyChangesToCard(cardChanges); if (isAttacker) { Unibus.Dispatch(CardManager.CARD_ATTACKED, cardDisplay); } }
public void Untap() { cardData.tapped = false; if (this.UnitDisplay) { this.UnitDisplay.Untap(); } this.cardBaseBlack.SetActive(false); Unibus.Dispatch(CARD_UNTAPPED, this); }
public void OnMoveCard(ServerActions.MoveCardAction action) { var cardTransform = cardIdToCards[action.cardId]; CardDisplay cardDisplay = cardTransform.GetComponent <CardDisplay>(); cardDisplay.CurrentMovingPoints = action.currentMovingPoints; boardCreator.MoveUnit(cardDisplay, action.position, action.path); Unibus.Dispatch(CardManager.CARD_MOVED, cardDisplay); }
public void OnCardHealed(ServerActions.CardHealedAction action) { this.CardAfterHealing(action.healerCard); var healerUnit = cardIdToCards[action.healerCard.id].GetComponent <CardDisplay>().UnitDisplay; var healedUnit = cardIdToCards[action.healedCard.id].GetComponent <CardDisplay>().UnitDisplay; Utils.Instance.LaunchMissile("HealEffects/Prefabs/HealEffect2", this.boardCreator.transform, healerUnit.transform, healedUnit.transform, 500, () => { var card = this.CardAfterHealing(action.healedCard); Unibus.Dispatch <CardDisplay>(CardManager.CARD_HEALED, card); }); }
protected override void OnBegin() { base.OnBegin(); Analytics.Event.GameStart(D.I.gameLevel); getCoin = 0; progress = 0; mLastWaveIndex = -1; D.I.adReviveCount = D.I.noAd ? 0 : 1; D.I.diamondReviveCount = D.I.IsVip() ? 1 : 0; D.I.CostEnergy(CT.table.energyBattleCost); Unibus.Dispatch(EventGameProcedure.Get(EventGameProcedure.Action.GameBegin)); mWaveModule.Start(); }
public void Tap() { cardData.tapped = true; if (this.UnitDisplay) { this.UnitDisplay.Tap(); } this.cardBaseBlack.SetActive(true); this.Shake(); Unibus.Dispatch(CARD_TAPPED, this); }
protected override void OnEnd(bool isWin) { base.OnEnd(isWin); Analytics.Event.GameOver(D.I.gameLevel, isWin, progress); mWaveModule.Stop(); D.I.BattleEnd(isWin); if (isWin) { Unibus.Dispatch(EventGameProcedure.Get(EventGameProcedure.Action.GameEndWin)); } else { Unibus.Dispatch(EventGameProcedure.Get(EventGameProcedure.Action.GameEndLose)); } }
void OnTileMouseLeftClick(Point position) { GameObject unit = Units[position.x, position.y]; if (unit) { UnitDisplay unitDisplay = unit.GetComponent <UnitDisplay>(); Unibus.Dispatch <UnitDisplay>(UNIT_CLICKED_ON_BOARD, unitDisplay); } else { Unibus.Dispatch <Point>(CLICKED_ON_VOID_TILE, position); } }
private void CheckHit() { foreach (var _v in EntityManager.GetAll <VirusBase>()) { var virus = _v as VirusBase; if (!virus.isAlive || virus.isInvincible) { continue; } if (virus.position.y > position.y && Mathf.Abs(virus.position.x - position.x) < effects[1] * 0.5f + virus.radius) { Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, virus, damage)); } } }
protected override void OnHit(VirusBase virus) { base.OnHit(virus); if (virus.isAlive && !virus.isInvincible) { Vector2 cDir = virus.position - position; Vector2 dir = (cDir + virus.direction).normalized; virus.SetDirection(dir); Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, virus, damage)); } mHitCount--; if (mHitCount <= 0) { ForceRecycle(); AudioManager.PlaySound(explosionSound); } }
private void OnTriggerEnter2D(Collider2D _collider) { if (!isAlive) { return; } if (_collider.tag == TagUtil.Virus) { var virus = _collider.GetComponent <VirusBase>(); if (virus != null && virus.isAlive) { Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, virus, mDamage)); PlayExplosion(virus.rectTransform.GetUIPos(), virus.radius); Recycle(); isAlive = false; } } }
private void PlayCard(string playerId, string cardId, Point position, bool taped, int newHp) { var cardTransform = cardIdToCards[cardId]; CardDisplay cardDisplay = cardTransform.GetComponent <CardDisplay>(); this.playerStacks[playerId].table.GetComponent <StackDisplay>().AddCard(cardDisplay); cardDisplay.CurrentHp = newHp; boardCreator.CreateUnit(cardDisplay, position); if (taped) { cardDisplay.Tap(); } cardDisplay.Play(); Unibus.Dispatch(CardManager.CARD_PLAYED, cardDisplay); }