void Start() { // b_restartGame.OnClickAsObservable().Subscribe(_=>{ // GameplayManager.Instance.ResetGame(); // }); // b_reset.OnClickAsObservable().Subscribe(_=>{ // OnResetPosition.OnNext(default); // }); gear_count.ObserveEveryValueChanged(g => g.Value).Subscribe(_ => { if (_ < 3) { img_lower_gear[_].DOFillAmount(1, gear_cooldown).SetAutoKill(); Observable.Timer(TimeSpan.FromSeconds(gear_cooldown)).Subscribe(timer => { gear_count.Value++; }).AddTo(this); } print(Depug.Log("Gear Count " + gear_count, Color.yellow)); }); b_back.OnClickAsObservable().Subscribe(_ => { PhotonNetworkConsole.Instance.LeaveRoom(); ObjectPool.Instance.Dispose(); SceneManager.LoadScene(SceneName.LOBBY); }); b_restart.OnClickAsObservable().Subscribe(_ => { Debug.Log("restart Click"); OnRestartPosition.OnNext(default);
public void SetController(bool _isActive) { Debug.Log("---------------------------->setcontroller " + _isActive); //isControll = _isActive; objectDetecter.SetActive(_isActive); //biker_joint_obj.SetActive(_isActive); //ragdollCollider.EnabledRagDolls(_isActive); ragdollObject.SetActive(_isActive); // RemoveEngine(); if (_isActive) { CrashDetecter.OnCrash.Subscribe(crashPosition => { crash = true; respawnPosition = new Vector3(crashPosition.x, crashPosition.y + 2.5f, startPosition.z); OnPlayerCrash.OnNext(crash); OnCrash(); }).AddTo(this); GameplayManager.OnGameEnd.Subscribe(_ => { isControll = false; ForceBrake(); print(Depug.Log("GameEnd !!!!!!!", Color.green)); }).AddTo(this); GameplayManager.OnGameStart.Subscribe(_ => { isControll = true; }).AddTo(this); GameHUD.OnLowerGear.Subscribe(_ => { myRigidbody.AddForce(transform.forward * myRigidbody.mass * lower_gear_force, ForceMode.Impulse); }).AddTo(this); } else { RemoveEngine(); } }
void CreateSlider() { Debug.Log("createSlider "); Hashtable property = PhotonNetwork.CurrentRoom.CustomProperties; Hashtable playerData = property[RoomPropertyKeys.PLAYER_DATA] as Hashtable; Hashtable playerIndexData = property[RoomPropertyKeys.PLAYER_INDEX] as Hashtable; Debug.LogWarningFormat("playerindex data {0}", playerIndexData); /// เกมถัดไปจากครั้งแรกมักเจอ error foreach (var playerIndex in playerIndexData) { Debug.Log(string.Format("index key {0} vale {1}", playerIndex.Key, playerIndex.Value)); var slider = Instantiate(playerSliderPrefab, Vector3.zero, Quaternion.identity, transformParent); Debug.Log("transformParent " + transformParent); Debug.Log("Slider " + slider); slider.name = playerIndex.Key.ToString(); slider.transform.localPosition = Vector3.zero; PlayerSliderPrefab sliderPrefab = slider.GetComponent <PlayerSliderPrefab>(); sliderPrefab.GetSlider().minValue = startPoint; sliderPrefab.GetSlider().maxValue = finishPoint; Debug.Assert(!dic_playerSlider.ContainsKey(playerIndex.Key.ToString())); if (dic_playerSlider.ContainsKey(playerIndex.Key.ToString())) { Debug.Log("Destroy dic_playerslider"); Destroy(dic_playerSlider[playerIndex.Key.ToString()].gameObject); dic_playerSlider.Remove(playerIndex.Key.ToString()); } dic_playerSlider.Add(playerIndex.Key.ToString(), sliderPrefab); var playerIndexProfileData = JsonConvert.DeserializeObject <PlayerIndexProfileData>(playerIndex.Value.ToString()); var playerProfileModel = GameUtil.ConvertToPlayFabPlayerProfilemodel(playerIndexProfileData.profileModel); var playerDistanceData = new PlayerDistanceData { playerIndex = playerIndexProfileData.index, userID = playerIndexProfileData.userId, playerName = playerProfileModel.DisplayName, distance = startPoint }; if (dic_playerDistance.ContainsKey(playerIndex.Key.ToString())) { Debug.Log("remove dic_playerslider"); dic_playerDistance[playerIndex.Key.ToString()] = null; dic_playerDistance.Remove(playerIndex.Key.ToString()); } print(Depug.Log("CheckplayerKey " + playerIndex.Key, Color.white)); print(Depug.Log("dic_playerDistance null? " + dic_playerDistance, Color.white)); dic_playerDistance.Add(playerIndex.Key.ToString(), playerDistanceData); print(Depug.Log("dic_playerDistance containkey? " + dic_playerDistance.ContainsKey(playerIndex.Key.ToString()), Color.green)); if (playerIndex.Key.ToString() == PhotonNetwork.LocalPlayer.UserId) { localUserId = PhotonNetwork.LocalPlayer.UserId; myDistanceData = playerDistanceData; mySliderPrefab = sliderPrefab; } sliderPrefab.SetUpData(playerData, colorRank[playerDistanceData.playerIndex]); } if (mySliderPrefab != null) { mySliderPrefab.transform.parent.SetAsLastSibling(); } print(Depug.Log("stripstringkey = " + PhotonNetwork.CurrentRoom.CustomProperties.StripToStringKeys(), Color.red)); }
public void SetTotalRound(int _totalRound) { print(Depug.Log("Settotal round " + _totalRound, Color.yellow)); totalRound.Value = _totalRound - 1; }
public void Init() { poolTransform = this.gameObject.transform; print(Depug.Log("Objectpool init ", Color.green)); }