예제 #1
0
    void GameSequenceEvent()
    {
        if (m_UpdateSequence)
        {
            return;
        }
        m_UpdateSequence = true;

        if (m_SequenceProgress[(int)m_GameSequence])
        {
            return;
        }

        float timer = TimerNet.GetTimer(m_SequenceTimerKey);

        if (timer > 0.0f)
        {
            return;
        }

        switch (m_GameSequence)
        {
        case E_GAMESEQUENCE.BEGINGAME:
        {
            SetNextGameSequence();
        }
        break;

        case E_GAMESEQUENCE.READY:
        {
            m_GameReadyCanvas.Run();
            SetNextGameSequence();
        }
        break;

        case E_GAMESEQUENCE.START:
        {
            if (m_GameReadyCanvas.IsComplete)
            {
                SetNextGameSequence();
            }
        }
        break;

        case E_GAMESEQUENCE.NORMALSTAGESTART:
        {
            m_SpawnManager.NormalMonsterSpawnStart();
            m_ControlCanvas.SetActive(true);
            m_SkillUICanvas.SetActive(true);
            m_GameUICanvas.TimeCheck(true);
            SetNextGameSequence();
        }
        break;

        case E_GAMESEQUENCE.NORMALSTAGE:
        {
            if (m_SpawnManager.IsAllNormalMonsterSpawnOperationsCompleted())
            {
                SetNextGameSequence(1.5f);
            }
        }
        break;

        case E_GAMESEQUENCE.NORMALSTAGE_END:
        {
            m_PianoEffect.CurtainClose();
            SetNextGameSequence(2.0f);
        }
        break;

        case E_GAMESEQUENCE.BOSSSTAGESTART:
        {
            m_PianoEffect.CurtainOpen();
            m_BossUICanvas.gameObject.SetActive(true);
            m_MyCharacter.transform.position = m_BossRoomStartPoint.position;
            m_MyCharacter.transform.rotation = Quaternion.identity;
            VerticalFollowCamera.SetDistanceSmooth(5.0f, 1.5f);
            SetNextGameSequence();
        }
        break;

        case E_GAMESEQUENCE.BOSSSTAGE:
        {
            m_SpawnManager.BossMonsterSpawnStart();
            SetNextGameSequence();
        }
        break;

        case E_GAMESEQUENCE.BOSSSTAGE_END:
        {
            if (m_SpawnManager.IsAllBossMonsterSpawnOperationsCompleted())
            {
                DeleteTeamAllUnits(E_TEAMTYPE.BLUE);
                DeleteTeamAllUnits(E_TEAMTYPE.GREEN);
                DeleteTeamAllUnits(E_TEAMTYPE.YELLOW);
                GameClearUIOpen();
                m_GameUICanvas.TimeCheck(false);
                SetNextGameSequence();
            }
        }
        break;

        case E_GAMESEQUENCE.AFTERGAME:
        {
            m_SequenceProgress[(int)m_GameSequence] = true;
        }
        break;

        default:
            break;
        }
    }
예제 #2
0
    IEnumerator C_Initialize()
    {
        WaitForSeconds wait = new WaitForSeconds(0.5f);

        if (GameManager.Instance.m_TestMode)
        {
            TestModeDefaultItemSetting list = Resources.Load <TestModeDefaultItemSetting>("TestModeDefaultItemList");
            list.SetTestDefaultItemInventory();

            TestModeServerConnect();
            while (!PhotonNetwork.InRoom)
            {
                yield return(null);
            }
        }

        NetworkManager.Instance.RoomController.SetLocalPlayerProperties(PlayerCharacter.m_CharacterReadyKey, false);
        NetworkManager.Instance.RoomController.SetLocalPlayerProperties("InitComp", false);

        yield return(wait);

        if (PhotonNetwork.IsMasterClient)
        {
            // timer set
            TimerNet.CreateDefaultTimer();
            TimerNet.InsertTimer(m_SequenceTimerKey, 0.0f, true);
        }

        yield return(wait);

        GameObject pianoUI = Instantiate(Resources.Load <GameObject>("PianoEffectCanvas"));

        m_PianoEffect = pianoUI.GetComponent <PianoEffectCanvas>();
        m_PianoEffect.Initialize();
        GameObject readyUI = Instantiate(Resources.Load <GameObject>("GameReadyCanvas"));

        m_GameReadyCanvas = readyUI.GetComponent <GameReadyCanvas>();
        m_ControlCanvas   = Instantiate(Resources.Load <GameObject>("ControlCanvas"));
        m_ControlCanvas.SetActive(false);
        GameObject gameUI = Instantiate(Resources.Load <GameObject>("GameUICanvas"));

        m_GameUICanvas = gameUI.GetComponent <GameUICanvas>();
        List <Item> droplist = new List <Item>();

        for (int i = 0; i < m_DropItemList.Length; ++i)
        {
            droplist.Add(m_DropItemList[i].m_Item);
        }
        m_GameUICanvas.Initialize(this, droplist);
        m_GameUICanvas.TimeCheck(false);
        gameUI.SetActive(false);
        m_SkillUICanvas = Instantiate(Resources.Load <GameObject>("SkillUICanvas"), Vector3.zero, Quaternion.identity);
        m_SkillUICanvas.SetActive(false);
        GameObject bossUI = Instantiate(Resources.Load <GameObject>("BossUICanvas"));

        m_BossUICanvas = bossUI.GetComponent <BossCharacterUI>();
        bossUI.SetActive(false);
        m_SpawnManager.Initialize();

        GameObject g = PhotonNetwork.Instantiate("PlayerCharacter", Vector3.zero, Quaternion.identity, 0, new object[] { -1, -1, -1, -1, -1, InventoryManager.Instance.GetPlayerModelName() });

        m_MyCharacter = g.GetComponent <PlayerCharacter>();
        m_MyCharacter.AddDeadEvent(MyCharacterDeadEvent);

        m_VerticalCamera = Instantiate(m_VerticalCamera, Vector3.zero, Quaternion.identity);
        VerticalFollowCamera verticalcamera = m_VerticalCamera.GetComponent <VerticalFollowCamera>();

        verticalcamera.Initialize(this, m_MyCharacter);
        m_VerticalCamera.SetActive(false);

        NetworkManager.Instance.RoomController.SetLocalPlayerProperties("InitComp", true);

        yield return(wait);

        while (!IsBeginLoadingComplete)
        {
            Player[] players     = PhotonNetwork.PlayerList;
            int      compcount   = 0;
            int      playercount = players.Length;

            foreach (Player p in players)
            {
                if (NetworkManager.Instance.RoomController.GetOtherPlayerPropertie <bool>(p, "InitComp"))
                {
                    ++compcount;
                }
            }

            if (compcount >= playercount)
            {
                IsBeginLoadingComplete = true;
            }
            yield return(null);
        }

        m_IsMultiplayGame = NetworkManager.Instance.RoomController.GetRoomPropertie <bool>(MultiPlayKey);

        while (!IsAfterLoadingComplete)
        {
            Player[] players = PhotonNetwork.PlayerList;

            bool complete = true;
            for (int i = 0; i < players.Length; ++i)
            {
                if (!NetworkManager.Instance.RoomController.GetOtherPlayerPropertie <bool>(players[i], PlayerCharacter.m_CharacterReadyKey))
                {
                    complete = false;
                }
            }
            if (complete)
            {
                InitializeComplete();
            }
            yield return(null);
        }
    }