Ejemplo n.º 1
0
 private void UpdateDrawing()
 {
     if (_actions.Get(EControllerBtns.Sure).WasPressed)
     {
         GameEventCenter.Send(GameEvent.UI_NextChat);
     }
 }
Ejemplo n.º 2
0
    private void UpdateMenu()
    {
        if (_actions.Get(EControllerBtns.Up).WasPressed)
        {
            GameEventCenter.Send(GameEvent.UI_Up);
        }

        if (_actions.Get(EControllerBtns.Down).WasPressed)
        {
            GameEventCenter.Send(GameEvent.UI_Down);
        }

        if (_actions.Get(EControllerBtns.Left).WasPressed)
        {
            GameEventCenter.Send(GameEvent.UI_Left);
        }

        if (_actions.Get(EControllerBtns.Right).WasPressed)
        {
            GameEventCenter.Send(GameEvent.UI_Right);
        }

        if (_actions.Get(EControllerBtns.Sure).WasPressed)
        {
            GameEventCenter.Send(GameEvent.UI_Sure);
        }

        if (_actions.Get(EControllerBtns.Cancel).WasPressed)
        {
            GameEventCenter.Send(GameEvent.UI_Back);
        }
    }
Ejemplo n.º 3
0
    private void OnDead()
    {
        if (IsDead)
        {
            return;
        }
        IsDead = true;

        //音效
        Sound.PlayUiAudioOneShot(Deploy.deadSound);

        //特效
        EffectFactory.PlayEffectOnce(Deploy.deadEffect, transform.position);

        //播放shader特效
        StageCamera2D.Instance.PlayDeadEffect(transform.position);

        //销毁僚机
        SupportMgr.Clear();

        //销毁自己
        Destroy(gameObject);

        //发事件
        GameEventCenter.Send(GameEvent.OnPlayerDead);

        //销毁子弹
        BulletExplosion.Create(transform.position, 0.3f);
    }
Ejemplo n.º 4
0
    private static IEnumerator LoadImpl(StageDeploy deploy, Action <StageBase> finishAction)
    {
        StageBase gameScene = null;

        yield return(UnloadCurrentScene());

        var sceneName = Path.GetFileNameWithoutExtension(deploy.resource);

#if UNITY_EDITOR
        yield return(SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive));
#else
        yield return(ResourceMgr.LoadScene(deploy.resource, LoadSceneMode.Additive));
#endif
        CurrentSceneName = sceneName;
        SceneManager.SetActiveScene(SceneManager.GetSceneByName(sceneName));
        GameEventCenter.Send(GameEvent.OnSceneChange);

        //挂脚本
        var typeScene   = GetSceneType(deploy.levelClass);
        var sceneObject = new GameObject("GameScene");
        var scene       = sceneObject.AddComponent(typeScene) as StageBase;
        scene.Deploy = deploy;
        yield return(scene.Init());

        finishAction?.Invoke(gameScene);
    }
Ejemplo n.º 5
0
    private IEnumerator DoBossDead()
    {
        //对话配置
        var dialogDeploy = DialogMgr.GetBossDialog(StageMgr.MainPlayer.Deploy.id, Deploy.id, false);

        //隐藏血条
        SetHpHudActive(false);

        //bossMark隐藏
        UIBattle.SetBossMarkActive(false);

        yield return(new WaitForSeconds(0.3f));

        //震屏
        if (StageCamera2D.Instance)
        {
            StageCamera2D.Instance.Shake(0.7f, 1.2f);
        }
        if (StageCamera3D.Instance)
        {
            StageCamera3D.Instance.Shake(0.7f, 1.2f);
        }

        Sound.PlayUiAudioOneShot(105);

        //播放shader特效
        StageCamera2D.Instance.PlayDeadEffect(transform.position);

        //隐藏renderer
        MainRenderer.enabled = false;
        if (_bossCircle)
        {
            _bossCircle.SetActiveSafe(false);
        }

        yield return(new WaitForSeconds(0.7f));

        //尝试显示对话
        if (dialogDeploy != null)
        {
            var list = DialogMgr.GetDrawList(dialogDeploy.dialogId);
            UIDrawingChat.Show(list, null,
                               () =>
            {
                GameEventCenter.Send(GameEvent.OnEnemyDie);
            });
        }
        else
        {
            GameEventCenter.Send(GameEvent.OnEnemyDie);
        }

        yield return(new WaitForSeconds(0.3f));

        Destroy(gameObject);
    }
Ejemplo n.º 6
0
    protected virtual void OnDead()
    {
        //特效
        EffectFactory.PlayEffectOnce(Deploy.deadEffect, transform.position);

        Sound.PlayUiAudioOneShot(104);

        GameEventCenter.Send(GameEvent.OnEnemyDie);

        Destroy(gameObject);
    }
Ejemplo n.º 7
0
    public void OnGraze()
    {
        if (Time.time - _lastGrazeTime > GrazeCd)
        {
            _lastGrazeTime = Time.time;

            //播放特效
            EffectFactory.PlayEffectOnce("effects_tex/prefab/Graze.prefab", transform.position);

            //播放音效
            Sound.PlayUiAudioOneShot(109, true);
        }

        //事件
        GameEventCenter.Send(GameEvent.OnGraze);
    }
Ejemplo n.º 8
0
 private static void CalcTimeScale()
 {
     //Debug.Log("SetTimeScale:" + timeScaleBulletTime + "*" + timeScaleForRunCover + "*" + timeScaleForPause);
     Time.timeScale = timeScaleBulletTime * timeScaleForPause;
     GameEventCenter.Send(GameEvent.TimeScaleChanged, Time.timeScale);
 }