private void OnEventAircraft(EventAircraft evt) { if (!isInit || !isBegin || !isRunning) { return; } if (evt.action == EventAircraft.Action.Crash) { if (D.I.adReviveCount > 0) { D.I.adReviveCount -= 1; GameReviveView.isDiamondRevive = false; GameManager.Instance.DelayDo(1, () => { UIManager.Open <GameReviveView>(UILayer.Top); }); GameModeManager.Instance.Pause(); } else if (D.I.diamondReviveCount > 0) { D.I.diamondReviveCount -= 1; GameReviveView.isDiamondRevive = true; GameManager.Instance.DelayDo(1, () => { UIManager.Open <GameReviveView>(UILayer.Top); }); GameModeManager.Instance.Pause(); } else { GameModeManager.Instance.End(false); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (!GameUtil.isInBattle) { return; } if (!isInvincible && collision.tag == TagUtil.Virus) { var crashPoint = (collision.transform.GetUIPos() - mCrashPointRoot.GetUIPos()).normalized * 40; ShowCrashPoint(crashPoint); UnibusEvent.Unibus.Dispatch(EventAircraft.Get(EventAircraft.Action.Crash)); } else if (collision.tag == TagUtil.Buff) { var buff = collision.gameObject.GetComponent <Buff>(); ProxyManager.GetProxy <BuffProxy>().AddBuff(buff.buffID); if (TableBuff.Get(buff.buffID).type == 1) { AudioManager.PlaySound("buff"); } else { AudioManager.PlaySound("debuff"); } buff.ForceRecycle(); } }
public static EventAircraft Get(Action action) { if (sIns == null) { sIns = new EventAircraft(); } sIns.action = action; return(sIns); }