コード例 #1
0
        private bool CheckGameOver()
        {
            m_gameOver = false;
            if (LifetimeManager.CatCount / m_habitatCount > m_supplyLimit)
            {
                m_gameOver = true;
            }
            else if (m_oxygen <= 0.0f)
            {
                m_gameOver = true;
            }
            else if (LifetimeManager.CatCount <= 0)
            {
                m_gameOver = true;
            }

            if (m_gameOver)
            {
                TimeManager.Unregister("Day", OnDayEnd);
                EventSystem.Dispatch(new Event_GameOver());
                EventSystem.Dispatch(new Event_UIText("GAME OVER SWEETIES"));
            }

            return(m_gameOver);
        }
コード例 #2
0
ファイル: Slot.cs プロジェクト: messatsuGoShoryuu/Habicat
        private void OnMouseDown()
        {
            if (UIManager.IsActive)
            {
                return;
            }
            SetColor(m_clicked);
            MENU_FLAGS flags = building == null ? MENU_FLAGS.BUILD : building.Flags;

            EventSystem.RemoveListener <Event_UIBuild>(OnBuild);
            EventSystem.RemoveListener <Event_UIUpgrade>(OnUpgrade);
            EventSystem.RemoveListener <Event_UIWorker>(OnWorker);

            List <GameObject> prefabs = new List <GameObject>();

            if (IsFlagSet(flags, MENU_FLAGS.BUILD))
            {
                prefabs.Add(GameObject.Instantiate(Resources.Load("Prefabs/Build")) as GameObject);
                EventSystem.AddListener <Event_UIBuild>(OnBuild);
            }
            if (IsFlagSet(flags, MENU_FLAGS.UPGRADE))
            {
                prefabs.Add(GameObject.Instantiate(Resources.Load("Prefabs/Upgrade")) as GameObject);
                EventSystem.Dispatch(new Event_UIUpgrade());
            }
            if (IsFlagSet(flags, MENU_FLAGS.WORKER))
            {
                prefabs.Add(GameObject.Instantiate(Resources.Load("Prefabs/Worker")) as GameObject);
            }

            EventSystem.Dispatch(new Event_BuildMenu(prefabs.ToArray()));
            Debug.Log("Mouse down");
        }
コード例 #3
0
 void OnDayEnd()
 {
     EventSystem.Dispatch(new Event_DayEnded());
     if (!CheckGameOver())
     {
         EventSystem.Dispatch(new Event_CatSpawned());
     }
 }
コード例 #4
0
ファイル: UIButton.cs プロジェクト: messatsuGoShoryuu/Habicat
        public void BtnClick()
        {
            switch (type)
            {
            case UIBUTTON_TYPE.BUILD:
                EventSystem.Dispatch(new Event_UIBuild());
                break;

            case UIBUTTON_TYPE.WORKER:
                EventSystem.Dispatch(new Event_UIWorker());
                break;

            case UIBUTTON_TYPE.UPGRADE:
                EventSystem.Dispatch(new Event_UIUpgrade());
                break;
            }
        }
コード例 #5
0
        private void OnDayEnd(Event_DayEnded e)
        {
            for (int i = m_cats.Count - 1; i >= 0; --i)
            {
                bool live = GameState.ConsumeLasagna(1);
                if (!live)
                {
                    m_cats[i].Die();
                    m_cats.Remove(m_cats[i]);
                }
            }

            EventSystem.Dispatch(new Event_UIText(""));
            string uiString = "";

            for (int i = 0; i < m_cats.Count; ++i)
            {
                uiString += (string.Format("Cats[{0}].CreationDate = {1}\n", i, m_cats[i].CreationDate));
                EventSystem.Dispatch(new Event_UIText(uiString));
            }
        }
コード例 #6
0
ファイル: Slot.cs プロジェクト: messatsuGoShoryuu/Habicat
 private void OnDayEnded(Event_DayEnded e)
 {
     EventSystem.Dispatch(new Event_BuildingYield(m_resourceType, GetYieldAmount()));
 }
コード例 #7
0
 public void Die()
 {
     EventSystem.Dispatch(new Event_CatDied());
 }