private void LevelEnd(TeamType loseTeam) { if (loseTeam == TeamType.BlueTeam) { WinTeam = TeamType.RedTeam; } else if (loseTeam == TeamType.RedTeam) { WinTeam = TeamType.BlueTeam; } isLevelEnd = true; OnLevelEnd?.Invoke(); LevelInfo.instance.EndMissle.SetActive(true); TSEngine.Instance.ExecuteOnNextUpdate(() => { float delay = LevelInfo.instance.EndMissle.GetComponent <MissleDown>().exploseDelay; TimeDelay.SetTimeout(() => { LevelInfo.instance.WaterEnd.GetComponent <DOTweenAnimation>().DOPlay(); TimeDelay.SetTimeout(() => { OnShowLevelEnd?.Invoke(); }, 6f); }, delay); }); }
private void Start() { this.GetComponent <Animation>().Play(); exploseDelay = this.GetComponent <Animation>().clip.length; TimeDelay.SetTimeout(() => { GameObject go = GameObject.Instantiate(FX_explose); go.transform.position = this.transform.position; go.transform.localScale = Vector3.one * Scale; this.gameObject.SetActive(false); }, exploseDelay); }
public void StartLevel(string levelName) { if (!PhotonNetwork.IsMasterClient) { return; } PhotonNetwork.CurrentRoom.IsVisible = false; PhotonNetwork.CurrentRoom.IsOpen = false; PhotonNetwork.LoadLevel(levelName); //暂时两秒作为level加载的时间 TimeDelay.SetTimeout(() => { object[] datas = new object[] { levelName }; RaiseEventOptions eventOptions = new RaiseEventOptions(); eventOptions.Receivers = ReceiverGroup.All; PhotonNetwork.RaiseEvent(RaiseEventCode.LEVEL_LOAD_END_EVENT, datas, eventOptions, SendOptions.SendReliable); }, 2f); }
public void OnPlayerDead(string playerId) { //客户端自己判断重生 if (PhotonNetwork.LocalPlayer.UserId == playerId) { //本地客户端玩家死亡 //三秒后重生 TimeDelay.SetTimeout(() => { LocalPlayerReborn(); }, 3f); } //主机判断Life剩余 if (PhotonNetwork.IsMasterClient) { if (IsRedTeam(playerId)) { ChangeLife(0, -1); } else if (isBlueTeam(playerId)) { ChangeLife(-1, 0); } } }
private void Start() { TimeDelay.SetTimeout(() => { Explose(); }, 2f); }
public void FadeOut(float time) { blackImg.CrossFadeAlpha(0, time, true); TimeDelay.SetTimeout(() => { blackUI.SetActive(false); }, time); }
private void Start() { DestoryDelay = GetComponent <ParticleSystem>().main.duration; //add 1 seconds to fade away TimeDelay.SetTimeout(() => { Destroy(gameObject); }, DestoryDelay + 1f); }