コード例 #1
0
	private void Awake()
	{
		if(this.pauseObject == null){ throw new NullReferenceException("Missing Pause object ref"); }
		this.pause = this.pauseObject.GetComponent<IPause>();
		this.pause.RaisePause += Pause_RaisePause;

		this.screenHeight = Screen.width * 0.3f;
	}
コード例 #2
0
ファイル: NodeParser.cs プロジェクト: ObliviousJamie/Clustri
 public NodeParser(IHyperLinkParser hyperLinkParser, IVertexFactory vertexFactory,
                   IProfileFactory profileFactory, IVertexCache cache, IPause pause)
 {
     _hyperLinkParser = hyperLinkParser;
     _vertexFactory   = vertexFactory;
     _profileFactory  = profileFactory;
     _cache           = cache;
     _pause           = pause;
 }
コード例 #3
0
 public PauseStateManager(GameObject pauseMenu, GameObject weaponMenu, PauseAudioSettings audioSettings)
 {
     this.pauseMenu     = pauseMenu;
     this.weaponMenu    = weaponMenu;
     this.audioSettings = audioSettings;
     unpausedState      = new UnpausedState(this);
     pauseMenuState     = new PauseMenuState(this);
     weaponMenuState    = new WeaponMenuState(this);
     currentState       = unpausedState;
     pauseMenu.SetActive(false);
     weaponMenu.SetActive(false);
 }
コード例 #4
0
        public void Resume()
        {
            pause = false;

            foreach (var entity in entityLoader.GetAllEntities())
            {
                IPause iPause = entity.Logic as IPause;
                if (iPause != null)
                {
                    iPause.Resume();
                }
            }

            cameraInput.Resume();
        }
コード例 #5
0
ファイル: RhythmController.cs プロジェクト: fafase/LCMusic
    private void Awake()
    {
        if (this.pauseObject == null)
        {
            throw new NullReferenceException("Missing Pause object ref");
        }
        this.pause             = this.pauseObject.GetComponent <IPause>();
        this.pause.RaisePause += Pause_RaisePause;
        SetObjectPool();

        this.uiRhythmController      = this.gameObject.GetComponent <UIRhythmController>();
        this.audioController         = this.gameObject.GetComponent <RhythmAudioController>();
        this.inputController         = this.gameObject.GetComponent <RhythmInputController>();
        this.challengeController     = this.gameObject.GetComponent <RhythmChallengeController>();
        this.inputController.enabled = false;
        this.beatCounter             = this.gameObject.GetComponent <IBeatCounter>();
        if (beatCounter == null)
        {
            throw new NullReferenceException("Missing IBeatCounter");
        }

        this.rhythmContainer = new RhythmContainer(this as IRhythmController, this as IRhythmStreak);
        this.pads            = this.rhythmContainer.CreateButtonsWithCurrentLesson();

        GetPadControllers(pads);

        Lesson currentLesson = this.rhythmContainer.CurrentLesson;
        Rhythm rhythm        = currentLesson.rhythm;

        SetUI(rhythm.IntroText, rhythm.bpmChallenge);
        foreach (IPadController pad in pads)
        {
            pad.SetBPM(rhythm.bpmChallenge);
        }
        this.streakContainer = new StreakContainer();

        this.uiRhythmController.SetStreakText(this.streakContainer.StreakCount.ToString());
        this.uiRhythmController.SetStyleNameText(currentLesson.name);

        this.beatCounter.Init(currentLesson.rhythm.bar);
        this.beatCounter.SetBeatCounterRunning(false);
        this.beatCounter.SetBpm(rhythm.bpmChallenge);

        this.challengeController.InitWithChallenges(rhythm.streakChallenge, rhythm.bpmChallenge);
    }
コード例 #6
0
 public void ShowEntity(int entityId, Type entityType, Action <Entity> showSuccess, EntityData entityData)
 {
     entityLoader.ShowEntity(entityId, entityType, (entity) =>
     {
         //这里处理一下,如果暂停前调用ShowEntity,暂停后才成功加载出来调用Entity的OnShow的话,那这个Entity是没被执行到IPause的逻辑的,这里在ShowEntity成功的回调下补充个调用IPause的逻辑
         if (pause == true)
         {
             IPause iPause = entity.Logic as IPause;
             if (iPause != null)
             {
                 iPause.Pause();
             }
         }
         if (showSuccess != null)
         {
             showSuccess(entity);
         }
     }, entityData);
 }
コード例 #7
0
ファイル: PauseManager.cs プロジェクト: dsuz/csharp-2021
    /// <summary>
    /// 一時停止・再開を切り替える
    /// </summary>
    void PauseResume()
    {
        m_pauseFlg = !m_pauseFlg;

        // 全ての GameObject を取ってきて、IPause を継承したコンポーネントが追加されていたら Pause または Resume を呼ぶ
        var objects = FindObjectsOfType <GameObject>();

        foreach (var o in objects)
        {
            IPause i = o.GetComponent <IPause>();

            if (m_pauseFlg)
            {
                i?.Pause();     // ここで「多態性」が使われている
            }
            else
            {
                i?.Resume();    // ここで「多態性」が使われている
            }
        }
    }
コード例 #8
0
ファイル: PauseMenu.cs プロジェクト: nolimet/Proeve
 /// <summary>
 /// Triggerd when the game is paused
 /// </summary>
 /// <param name="obj">contains pause state</param>
 private void OnPause(IPause obj)
 {
     gameObject.SetActive(obj.State);
 }