コード例 #1
0
    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);
    }
コード例 #2
0
 private void OnDestroy()
 {
     OnPauseToggle.RemoveAllListeners();
     OnLoseGame.RemoveAllListeners();
     OnHealthChange.RemoveAllListeners();
     OnScoreChange.RemoveAllListeners();
 }
コード例 #3
0
    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;
    }
コード例 #4
0
 private void OnDisable()
 {
     UnregisterAllHitboxes();
     dieEvent.RemoveAllListeners();
     damageEvent.RemoveAllListeners();
     healthUpdateEvent.RemoveAllListeners();
 }
コード例 #5
0
    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);
        });
    }
コード例 #6
0
 protected virtual void OnDestroy()
 {
     OnShowEvent.RemoveAllListeners();
     OnHideEvent.RemoveAllListeners();
     OnShowFinishedEvent.RemoveAllListeners();
     OnHideFinishedEvent.RemoveAllListeners();
 }
コード例 #7
0
    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;
            }
        }
    }
コード例 #8
0
 /**
  * SetEventAction
  * @brief このメニューで実行するアクションを外部から設定する
  * @param[in] setAction このメニューで実行するAction
  */
 public void SetEventAction(UnityAction setAction)
 {
     //初期化
     m_launchEvent.RemoveAllListeners();
     //Actionの追加
     m_launchEvent.AddListener(setAction);
 }
コード例 #9
0
 public override void Stop()
 {
     base.Stop();
     OnLiftedObjectsOutput.RemoveAllListeners();
     OnMultiBoxRectsOutput.RemoveAllListeners();
     OnMultiBoxLandmarksOutput.RemoveAllListeners();
 }
コード例 #10
0
 // Use this for initialization
 void Awake()
 {
     onClean.Invoke();
     onClean.RemoveAllListeners();
     onCleanPermanently.Invoke();
     Match.Init();
 }
コード例 #11
0
        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();
            }
        }
コード例 #12
0
 void OnDestroy()
 {
     if (BackKeyCallBack != null)
     {
         BackKeyCallBack.RemoveAllListeners();
     }
 }
コード例 #13
0
 //!
 //! Execute on finish. Will call finish callback function
 //!
 private void OnFinish()
 {
     currentAmount = 1f;
     OnFinishEvent.Invoke();
     // Make sure its clean for nexts
     OnFinishEvent.RemoveAllListeners();
 }
コード例 #14
0
    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;
        }
    }
コード例 #15
0
 public void SetOnClick(UnityAction unityAction)
 {
     // remove all previous listeners
     onClick.RemoveAllListeners();
     // set new listener
     onClick.AddListener(unityAction);
 }
コード例 #16
0
ファイル: SCButton.cs プロジェクト: Skodeva/SDK4
 public virtual void OnDestroy()
 {
     if (onClick != null)
     {
         onClick.RemoveAllListeners();
     }
 }
コード例 #17
0
    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();
        }
    }
コード例 #18
0
ファイル: GameManager.cs プロジェクト: Danilock/Swords
 public void DoFadeAndSetLoadingState()
 {
     currentGameState = GameState.Loading;
     OnLevelRestart.RemoveAllListeners();
     gameManagerAnimator.SetBool("LoadLevel", true);
     sound?.FadeSound(true);
 }
コード例 #19
0
    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();
        }
    }
コード例 #20
0
 private void UpdateCrewDeployed()
 {
     crewDeployed.RemoveAllListeners();
     crewDeployed.AddListener(Target.ReadCardFromAsset);
     crewDeployed.AddListener(GameLogicEvents.DeployCrew);
     crewDeployed.AddListener(CrewAssigner.instance.UpdateCrewItems);
 }
コード例 #21
0
ファイル: Alien.cs プロジェクト: NicholasVoss/BobbleheadWars
    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);
    }
コード例 #22
0
        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);
        }
コード例 #23
0
ファイル: Alien.cs プロジェクト: roryjl-n/BobbleheadWars
    // 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);
    }
コード例 #24
0
ファイル: BetterButton.cs プロジェクト: lumoh/TT
    protected override void OnDestroy()
    {
        base.OnDestroy();

        onButtonDown.RemoveAllListeners();
        onButtonUp.RemoveAllListeners();
    }
コード例 #25
0
 void OnDisable()     // PERFORMANCE do we need LevelManger events RemoveAllListeners() OnDisble
 {
     Debug.Log("Level Man Disabled");
     OnIntroEventEnd.RemoveAllListeners();
     StartScriptedEvent.RemoveAllListeners();
     EnableSpawnSystem.RemoveAllListeners();
 }
コード例 #26
0
 public void ResetData()
 {
     total   = 0;
     current = 0;
     OnDamage.RemoveAllListeners();
     OnRepair.RemoveAllListeners();
 }
コード例 #27
0
        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);
                }
            }
        }
コード例 #28
0
 private void ResetListeners()
 {
     m_OnMouseOver.RemoveAllListeners();
     m_OnMouseExit.RemoveAllListeners();
     m_OnLock.RemoveAllListeners();
     m_OnStart.RemoveAllListeners();
 }
コード例 #29
0
 // 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();
     }
 }
コード例 #30
0
 public void RemoveAllListeners()
 {
     startHeistCountdown.RemoveAllListeners();
     startHeist.RemoveAllListeners();
     endMoneyTruckPhase.RemoveAllListeners();
     endHeist.RemoveAllListeners();
     addToScore.RemoveAllListeners();
 }