Пример #1
0
    IEnumerator waitingEndofPlay(int index)
    {
        text.text = index + "Start Playing";
        bool isPlaying     = false;
        bool isFinishVideo = false;

        while (enabled)
        {
            yield return(new WaitForSeconds(0.1f));

            text.text = index + "Start Playing/" + videoPlayer.isPlaying;
            if (!videoPlayer.isPlaying && !isPlaying)
            {
                if (!isFinishVideo)
                {
                    videoPlayer.Stop();
                    videoPlayer.clip = videos[index];
                    videoPlayer.Play();
                    text.text     = index + "Start";
                    isPlaying     = true;
                    isFinishVideo = true;
                }
                else
                {
                    text.text = index + "Finish Playing";
                    MainGameProjectManager.GetInstance().localPlayer.CmdReSetFinishPlayerVideo(false);
                    break;
                }
            }
            else if (videoPlayer.isPlaying && isPlaying)
            {
                isPlaying = false;
            }
        }
    }
Пример #2
0
 public void CmdSetReadyForGame(bool isReady)
 {
     IsPlayReadyForGame = isReady;
     if (IsPlayReadyForGame)
     {
         MainGameProjectManager.GetInstance().CheckAllInPlayerPosition();
     }
 }
Пример #3
0
 public void OnSetTurnGuide(Transform target)
 {
     turnGuide.transform.parent        = target;
     turnGuide.transform.localPosition = Vector3.zero;
     turnGuide.transform.localRotation = Quaternion.identity;
     sightCtrl._transform = MainGameProjectManager.GetInstance().localPlayer.GetComponent <MainPlayer>().camera.transform;
     turnGuide.SetActive(true);
 }
Пример #4
0
    public void SetHandEventObj()
    {
        if (MainGameProjectManager.GetInstance().localPlayer == null)
        {
            return;
        }
        Transform pos = MainGameProjectManager.GetInstance().localPlayer.GetComponent <MainPlayer>().camera.transform;

        transform.position = new Vector3(transform.position.x, pos.position.y + 0.3f, transform.position.z);
        gameObject.SetActive(true);
    }
    public void SetPlayerScores()
    {
        StartCoroutine(cWaitTimeCallBack(0.1f, () =>
        {
            Dictionary <GameObject, MissionInfo> players = MainGameProjectManager.GetInstance().players;
            int index = 0;
            foreach (var element in players)
            {
                playerScores[index].SetPlayerScore(element.Value.deviceColor, element.Value.score);
                index++;
            }

            scoreUI.SetActive(true);
        }));
    }
Пример #6
0
    IEnumerator AddScoreToLocalPlayerCOU()
    {
        int result = 0;

        for (int i = 0; i < eventScores.Length; i++)
        {
            result += eventScores[i].GetScore();
            Debug.Log(eventScores[i].GetScore());
        }

        MainGameProjectManager.GetInstance().localPlayer.AddScore(result);
        yield return(new WaitForSeconds(0.1f));

        for (int i = 0; i < offObjs.Length; i++)
        {
            offObjs[i].SetActive(false);
        }
    }
    public void OnFinishEventCreen()
    {
        if (!isServerOnly)
        {
            return;
        }
        Debug.Log(isServerOnly);
        Dictionary <string, C_TracfficLight> tracfficLights = watchingTrafficLightRaycastBoard.dicTrafficLight;
        Dictionary <GameObject, MissionInfo> players        = MainGameProjectManager.GetInstance().players;

        foreach (var element in players)
        {
            Debug.Log(element.Value.deviceName);
            if (!tracfficLights[element.Value.deviceName].isFinish)
            {
                element.Value.AddScoreOnServer(-10);
            }
        }
    }
Пример #8
0
 // Start is called before the first frame update
 void Start()
 {
     if (isLocalPlayer)
     {
         target.tag = "Player";
         MainGameProjectManager.GetInstance().localPlayer = this;
         string playerName = NetworkRoomManagerExt.singleton.GetComponent <ProjectManager>().localDeviceName;
         CmdSetPlayerDeviceName(playerName);
         SetPlayerMovePosition(playerName);
         CmdSetPlayerMovePosition(playerName);
         CmdSetPlayerColor(NetworkRoomManagerExt.singleton.GetComponent <ProjectManager>().localDeviceColor);
         Debug.Log(isLocalPlayer);
     }
     else
     {
         target.tag = "NetworkPlayer";
     }
     MainGameProjectManager.GetInstance().AddPlayers(this.gameObject);
     Debug.Log("MainGameProjectManager.GetInstance().players.Add");
 }
 public void AddSocre(int score)
 {
     MainGameProjectManager.GetInstance().localPlayer.AddScore(score);
 }
Пример #10
0
 public void CmdSetPlayer(GameObject obj)
 {
     MainGameProjectManager.GetInstance().AddPlayers(obj);
 }
Пример #11
0
 public void SetPlayerMovePosition(string newname)
 {
     Debug.Log("SetPlayerMovePosition" + newname);
     MainGameProjectManager.GetInstance().SetPlayerMovePosition(newname);
 }
Пример #12
0
 public void CmdSetPlayerDeviceName(string _deviceName)
 {
     deviceName = _deviceName;
     MainGameProjectManager.GetInstance().playersOnlyOnServer.Add(deviceName, this);
 }
Пример #13
0
 public void AddScoreOnServer(int addSocre)
 {
     score += addSocre;
     MainGameProjectManager.GetInstance().UpdateUI();
     Debug.Log(deviceColor + "/" + score);
 }
 public void FinishMission()
 {
     MainGameProjectManager.GetInstance().localPlayer.AddScore(Test);
 }
Пример #15
0
    IEnumerator VideoPlayEventCourutine()
    {
        bool isPlaying = false;

        Dictionary <GameObject, MissionInfo> players = MainGameProjectManager.GetInstance().players;

        while (enabled)
        {
            yield return(null);

            Debug.Log(videoPlayer.isPlaying + "/" + isPlaying);
            if (!videoPlayer.isPlaying && !isPlaying)
            {
                bool IsAllStop = true;

                foreach (var element in players)
                {
                    if (element.Value.IsPlayingVideoMission)
                    {
                        IsAllStop = false;
                        break;
                    }
                }

                if (IsAllStop)
                {
                    index++;

                    if (index < videos.Length)
                    {
                        Debug.Log(index + "Start");
                        text.text = index + "Start";
                        videoPlayer.Stop();
                        videoPlayer.clip = videos[index];
                        videoPlayer.Play();
                        isPlaying = true;
                        RpcPlayVideo(index);
                    }
                    else
                    {
                        yield return(new WaitForSeconds(0.1f));

                        Debug.Log("FinishEvent");
                        if (OnEndEvent != null)
                        {
                            OnEndEvent.Invoke();
                        }
                        RpcOnEndEventNetwork();
                        //OffWindow();
                        //RpcOffWindow();
                        break;
                    }
                }
            }
            else if (videoPlayer.isPlaying && isPlaying)
            {
                Debug.Log(videoPlayer.isPlaying + "/" + isPlaying);
                isPlaying = false;
            }
        }
    }