コード例 #1
0
ファイル: HudController.cs プロジェクト: baneand/potions
 private void Start()
 {
     if (m_Display == null)
     {
         m_Display = GetComponentInChildren <PeriodTimeDisplay>();
     }
     if (m_CanvasGroup == null)
     {
         m_CanvasGroup = GetComponentInChildren <CanvasGroup>();
     }
     EegerCommand.Instance.Register(CommandReceiver.PAUSE, args => Pause());
     EegerCommand.Instance.Register(CommandReceiver.RUN, args => Run());
     Pause();
 }
コード例 #2
0
ファイル: GamePauser.cs プロジェクト: baneand/potions
    //Pause the whole game
    public void Pause()
    {
        //Time.timeScale = 0.0f;
        m_PauseScreen.alpha        = 1f;
        m_PauseScreen.interactable = m_PauseScreen.blocksRaycasts = true;
        if (m_TotalTimeText != null)
        {
            m_TotalTimeText.text = PeriodTimeDisplay.ConvertToTimeDisplay(PeriodTimeManager.Instance.TotalTime);
        }
        if (m_TotalRewardText != null)
        {
            m_TotalRewardText.text = PeriodTimeManager.Instance.TotalRewards.ToString();
        }
        var periods = PeriodTimeManager.Instance.GetLastPeriods(m_MaxItemsToShow * m_PossibleParents.Length);

        if (periods == null || m_TemplateDisplay == null)
        {
            return;
        }
        int sub_value        = 0;
        int total_Reward_num = 0;

        for (int i = 0; i < periods.Length; i++)
        {
            if (m_TimeDisplays.Count <= i)
            {
                m_TimeDisplays.Add(m_TemplateDisplay.Duplicate());
            }
            var item   = m_TimeDisplays[i];
            var period = periods[i];
            item.UpdateFromPeriod(period);
            item.RewardCount -= sub_value;
            sub_value        += item.RewardCount;
            total_Reward_num += item.RewardCount;
            item.transform.SetParent(m_PossibleParents[i / m_MaxItemsToShow]);
            m_PossibleParents[i / m_MaxItemsToShow].gameObject.SetActive(true);
        }
        m_TotalRewardText.text = total_Reward_num.ToString();
    }