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; } } }
public void CmdSetReadyForGame(bool isReady) { IsPlayReadyForGame = isReady; if (IsPlayReadyForGame) { MainGameProjectManager.GetInstance().CheckAllInPlayerPosition(); } }
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); }
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 static MainGameProjectManager GetInstance() { if (!instance) { instance = (MainGameProjectManager)GameObject.FindObjectOfType(typeof(MainGameProjectManager)); if (!instance) { Debug.LogError("There needs to be one active MyClass script on a GameObject in your scene."); } } return(instance); }
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); })); }
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); } } }
// 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); }
public void CmdSetPlayer(GameObject obj) { MainGameProjectManager.GetInstance().AddPlayers(obj); }
public void SetPlayerMovePosition(string newname) { Debug.Log("SetPlayerMovePosition" + newname); MainGameProjectManager.GetInstance().SetPlayerMovePosition(newname); }
public void CmdSetPlayerDeviceName(string _deviceName) { deviceName = _deviceName; MainGameProjectManager.GetInstance().playersOnlyOnServer.Add(deviceName, this); }
public void AddScoreOnServer(int addSocre) { score += addSocre; MainGameProjectManager.GetInstance().UpdateUI(); Debug.Log(deviceColor + "/" + score); }
public void FinishMission() { MainGameProjectManager.GetInstance().localPlayer.AddScore(Test); }
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; } } }