public void Die() { isAlive = false; head.GetComponent <Animator>().enabled = false; head.isKinematic = false; head.useGravity = true; head.GetComponent <SphereCollider>().enabled = true; head.gameObject.transform.parent = null; Vector3 position = head.transform.position; position[1] = 13; head.transform.position = position; head.velocity = new Vector3(0, 26.0f, 3.0f); if (deathParticles) { deathParticles.transform.parent = null; position = deathParticles.transform.position; position[1] = 13; deathParticles.transform.position = position; deathParticles.Activate(); } OnDestroy.Invoke(); OnDestroy.RemoveAllListeners(); head.GetComponent <SelfDestruct>().Initiate(); Destroy(gameObject); }
private void OnDestroy() { OnPauseToggle.RemoveAllListeners(); OnLoseGame.RemoveAllListeners(); OnHealthChange.RemoveAllListeners(); OnScoreChange.RemoveAllListeners(); }
private IEnumerator ShowIterator(bool showFlag) { var showSpeed = showFlag ? 3.0f : -3.0f; while (true) { canvas.alpha += Time.deltaTime * showSpeed; if (showFlag) { canvas.blocksRaycasts = true; if (canvas.alpha >= 1.0f) { canvas.alpha = 1.0f; break; } } else { if (canvas.alpha <= 0.0f) { canvas.alpha = 0.0f; canvas.blocksRaycasts = false; IsShow = false; OnClose(); OnClosed.Invoke(); OnClosed.RemoveAllListeners(); break; } } yield return(null); } coroutine = null; }
private void OnDisable() { UnregisterAllHitboxes(); dieEvent.RemoveAllListeners(); damageEvent.RemoveAllListeners(); healthUpdateEvent.RemoveAllListeners(); }
public void InitItem() { splineMove = GetComponent <splineMove>(); if (null == splineMove) { splineMove = gameObject.AddComponent <splineMove>(); } boxcollider = GetComponent <BoxCollider2D>(); foodImg = GetComponent <Image>(); splineMove.pathContainer = GameCtrl._Ins.mapCurve; splineMove.speed = GameCtrl._Ins.GetCurrLevelData().Movespeed; splineMove.pathMode = DG.Tweening.PathMode.TopDown2D; splineMove.loopType = splineMove.LoopType.loop; //Debug.Log($"{transform.name} = {transform.position},vector[0]:{splineMove.pathContainer.GetPathPoints()[0]}"); //transform.position = splineMove.pathContainer.GetPathPoints()[0]; //Debug.Log($"{transform.name} = {transform.position},vector[0]:{splineMove.pathContainer.GetPathPoints()[0]}"); splineMove.StartMove(); // 事件必须在 startMove() 调用了在添加 //Debug.Log($"曲线事件长度 = {splineMove.events.Count}"); UnityEvent myEvent = splineMove.events[splineMove.events.Count - 1]; myEvent.RemoveAllListeners(); myEvent.AddListener(() => { //Debug.Log($"到达曲线终点,pointIndex = {splineMove.events.Count - 1}"); ResetItem(); GameCtrl._Ins.EC.OnFoodArriveEndPoint?.Invoke(this); }); }
protected virtual void OnDestroy() { OnShowEvent.RemoveAllListeners(); OnHideEvent.RemoveAllListeners(); OnShowFinishedEvent.RemoveAllListeners(); OnHideFinishedEvent.RemoveAllListeners(); }
private IEnumerator FadeOutLoop() { while (isFading) { if (fadePercentage < 1) { fadePercentage += Time.deltaTime / fadeTime; } fadeImage.color = Color.Lerp(fadeColorEnd, fadeColorStart, fadePercentage); loadingWheel.color = Color.Lerp(loadingWheelColorEnd, loadingWheelColorStart, fadePercentage); yield return(null); if (fadePercentage >= 1) { if (OnFadeOut != null) { OnFadeOut.Invoke(); OnFadeOut.RemoveAllListeners(); } isFading = false; } } }
/** * SetEventAction * @brief このメニューで実行するアクションを外部から設定する * @param[in] setAction このメニューで実行するAction */ public void SetEventAction(UnityAction setAction) { //初期化 m_launchEvent.RemoveAllListeners(); //Actionの追加 m_launchEvent.AddListener(setAction); }
public override void Stop() { base.Stop(); OnLiftedObjectsOutput.RemoveAllListeners(); OnMultiBoxRectsOutput.RemoveAllListeners(); OnMultiBoxLandmarksOutput.RemoveAllListeners(); }
// Use this for initialization void Awake() { onClean.Invoke(); onClean.RemoveAllListeners(); onCleanPermanently.Invoke(); Match.Init(); }
public void Emit(string eventName, object[] args = null) { if (!Events.ContainsKey(eventName)) { throw new Exception("No event with name: " + eventName); } if (args == null) { args = defaultArguments; } isEmitting = true; UnityEvent <object[]> permanentEvent = Events[eventName]; UnityEvent <object[]> oneTimeEvent = OnceEvents[eventName]; permanentEvent.Invoke(args); oneTimeEvent.Invoke(args); oneTimeEvent.RemoveAllListeners(); isEmitting = false; while (QueuedActionsOnEmitter.Count > 0) { QueuedActionsOnEmitter.Dequeue().Invoke(); } }
void OnDestroy() { if (BackKeyCallBack != null) { BackKeyCallBack.RemoveAllListeners(); } }
//! //! Execute on finish. Will call finish callback function //! private void OnFinish() { currentAmount = 1f; OnFinishEvent.Invoke(); // Make sure its clean for nexts OnFinishEvent.RemoveAllListeners(); }
private IEnumerator AlphaTransition(float _fadeTime) { while (!s_isValid) { yield return(new WaitForEndOfFrame()); } float alfa = _fadeTime < 0 ? 1.0f : 0.0f; IsFinish = false; Color color = s_fadePanel.color; while (0.0f <= alfa && alfa <= 1.0f) { alfa += Time.deltaTime / _fadeTime; s_fadePanel.color = new Color(color.r, color.g, color.b, alfa); yield return(new WaitForEndOfFrame()); } IsFinish = true; if (m_isCallBackValid) { m_callBack.Invoke(); m_callBack.RemoveAllListeners(); m_isCallBackValid = false; } }
public void SetOnClick(UnityAction unityAction) { // remove all previous listeners onClick.RemoveAllListeners(); // set new listener onClick.AddListener(unityAction); }
public virtual void OnDestroy() { if (onClick != null) { onClick.RemoveAllListeners(); } }
public void Release() { Stop(); if (_mediaPlayer != null) { // Release MediaPlayer _mediaPlayer.Release(); _mediaPlayer = null; if (_mediaPlayerLoop != null) { _mediaPlayerLoop.Release(); } if (_videoHostingParser != null) { _videoHostingParser.Release(); } RemoveListeners(); _openingEvent.RemoveAllListeners(); _bufferingEvent.RemoveAllListeners(); _preparedEvent.RemoveAllListeners(); _playingEvent.RemoveAllListeners(); _pausedEvent.RemoveAllListeners(); _stoppedEvent.RemoveAllListeners(); _endReachedEvent.RemoveAllListeners(); _encounteredErrorEvent.RemoveAllListeners(); _timeChangedEvent.RemoveAllListeners(); _positionChangedEvent.RemoveAllListeners(); _snapshotTakenEvent.RemoveAllListeners(); } }
public void DoFadeAndSetLoadingState() { currentGameState = GameState.Loading; OnLevelRestart.RemoveAllListeners(); gameManagerAnimator.SetBool("LoadLevel", true); sound?.FadeSound(true); }
private void FixedUpdate() { if (delayTime > 0f) { delayTime -= Time.fixedDeltaTime; if (textBinds != null) { foreach (var i in textBinds) { if (!useFloatingValues) { i.text = Mathf.RoundToInt(delayTime).ToString(); } else { i.text = delayTime.ToString().Substring(0, delayTime.ToString().Length - 2); } } } antiDelayTime += Time.unscaledDeltaTime; if (targetValue - antiDelayTime < 0.1f && antiDelayTime < targetValue) { targetValue++; onSecondPassed.Invoke(); } onTick.Invoke(); } if (delayTime < 0.1f && delayTime > 0f) { delayTime = 0f; onTimerReachedEnd.Invoke(); onSecondPassed.RemoveAllListeners(); } }
private void UpdateCrewDeployed() { crewDeployed.RemoveAllListeners(); crewDeployed.AddListener(Target.ReadCardFromAsset); crewDeployed.AddListener(GameLogicEvents.DeployCrew); crewDeployed.AddListener(CrewAssigner.instance.UpdateCrewItems); }
public void Die() { //kills alien and makes it fall apart isAlive = false; head.GetComponent <Animator>().enabled = false; head.isKinematic = false; head.useGravity = true; head.GetComponent <SphereCollider>().enabled = true; head.gameObject.transform.parent = null; head.velocity = new Vector3(0, 26.0f, 3.0f); //removes listeners and destroys object OnDestroy.Invoke(); OnDestroy.RemoveAllListeners(); SoundManager.Instance.PlayOneShot(SoundManager.Instance.alienDeath); head.GetComponent <SelfDestruct>().Initiate(); if (deathParticles) { //makes blood splatter when alien dies deathParticles.transform.parent = null; deathParticles.Activate(); } Destroy(gameObject); }
public static void SubscribeEvents() { eventUpdateCurrentEncounter.RemoveAllListeners(); eventUpdateCurrentEncounter.AddListener(GameLogicEvents.UpdateCurrentEncounter); eventUpdateLossCounter.RemoveAllListeners(); eventUpdateLossCounter.AddListener(Visual.instance.UpdateLossCounter); eventUpdateCrewCounter.RemoveAllListeners(); eventUpdateCrewCounter.AddListener(Visual.instance.UpdateCrewCounter); eventNewEffect.RemoveAllListeners(); eventNewEffect.AddListener(raiseNewEffect); eventRemoveSingleEffects.RemoveAllListeners(); eventRemoveSingleEffects.AddListener(removeSingleEffects); eventAddSingleUsedTreausreTouchListener.RemoveAllListeners(); eventAddSingleUsedTreausreTouchListener.AddListener(AddSingleUsedTreasureTouchListener); eventCardVisual.RemoveAllListeners(); eventCardVisual.AddListener(ShowCardVisualEvent); eventRestoreCrew.RemoveAllListeners(); eventRestoreCrew.AddListener(RestoreCrewByCard); }
// This code works similarly to the marine’s death, but we disable the Animator for the alien. // In addition, this code launches the head off the body. public void Die() { isAlive = false; head.GetComponent <Animator>().enabled = false; head.isKinematic = false; head.useGravity = true; head.GetComponent <SphereCollider>().enabled = true; head.gameObject.transform.parent = null; head.velocity = new Vector3(0, 26.0f, 3.0f); //This block notifies the listeners, removes them and then it deletes the GameObject. OnDestroy.Invoke(); OnDestroy.RemoveAllListeners(); SoundManager.Instance.PlayOneShot(SoundManager.Instance.alienDeath); // head.GetComponent <SelfDestruct>().Initiate(); //This makes the blood splatter when an alien dies. if (deathParticles) { deathParticles.transform.parent = null; deathParticles.Activate(); } Destroy(gameObject); }
protected override void OnDestroy() { base.OnDestroy(); onButtonDown.RemoveAllListeners(); onButtonUp.RemoveAllListeners(); }
void OnDisable() // PERFORMANCE do we need LevelManger events RemoveAllListeners() OnDisble { Debug.Log("Level Man Disabled"); OnIntroEventEnd.RemoveAllListeners(); StartScriptedEvent.RemoveAllListeners(); EnableSpawnSystem.RemoveAllListeners(); }
public void ResetData() { total = 0; current = 0; OnDamage.RemoveAllListeners(); OnRepair.RemoveAllListeners(); }
public void SetData(ItemStack stack, ButtonArgument arg = null) { this.stack = stack; onPointerEvent.RemoveAllListeners(); CommonAttributes atr = stack.item.GetAttribute <CommonAttributes>(); if (atr) { this.InventorySprite.sprite = atr.GetSprite(); this.Amounttext.text = this.stack.amount.ToString(); if (this.Amounttext.text == "1") { this.Amounttext.enabled = false; } else { this.Amounttext.enabled = true; } } if (arg != null) { foreach (UnityAction argument in arg.onClickCallback) { onPointerEvent.AddListener(argument); } } }
private void ResetListeners() { m_OnMouseOver.RemoveAllListeners(); m_OnMouseExit.RemoveAllListeners(); m_OnLock.RemoveAllListeners(); m_OnStart.RemoveAllListeners(); }
// Hides the ui menu on screen playing an animation if has one public void Hide(bool selfDestroy = false) { if (selfDestroy) { OnMenuHidden.AddListener(Delete); } if (anim != null) { anim.SetBool("IsOpen", false); StartCoroutine(WaitFor("Closed")); } else if (OnMenuHidden != null) { OnMenuHidden.Invoke(); OnMenuHidden.RemoveAllListeners(); } }
public void RemoveAllListeners() { startHeistCountdown.RemoveAllListeners(); startHeist.RemoveAllListeners(); endMoneyTruckPhase.RemoveAllListeners(); endHeist.RemoveAllListeners(); addToScore.RemoveAllListeners(); }