void CheckLifeLoop() { if (Network.isServer) { CancelInvoke("CheckLifeLoop"); return; } if (GlobalScript.GetInstance().player.Life == 10) { FadeIn(); } }
// Use this for initialization void Awake() { IsNotSubYouLiang = pcvr.IsTestGetInput; speedUi = Speed.GetComponent <UISprite>(); EnergyUi = Energy.GetComponent <UISprite>(); EnergyUi.fillAmount = 0.8f; GlobalScript.GetInstance().player.SpeedChange += SpeedChange; GlobalScript.GetInstance().player.EnergyChange += EnergyChange; GlobalScript.GetInstance().player.AddBufferEvent += AddBufferEvent; tweenAlpha = EnergyF.GetComponent <TweenAlpha>(); tweenAlpha1 = speedF.GetComponent <TweenAlpha>(); }
// Update is called once per frame void Update() { MoveSpeed += AddMoveSpeed; tranObj.localPosition = moveVec * MoveSpeed + tranObj.localPosition; //ScreenLog.Log("pos " + tranObj.localPosition); float moveDis = Vector3.Distance(tranObj.localPosition - StartPos, Vector3.zero); if (disMax <= moveDis) { GlobalScript.GetInstance().player.AddBuffer(DaoJuType); Destroy(gameObject); } }
// Update is called once per frame void Update() { GlobalScript.GetInstance().player.Speed = speed; GlobalScript.GetInstance().player.Energy = Energy; GlobalScript.GetInstance().player.Score = score; //GlobalScript.GetInstance().player.IsGameOver=IsGameOver; GlobalScript.GetInstance().player.WaitingRequest = WaitingRequest; GlobalScript.GetInstance().player.IsRequested = IsRequested; //GlobalScript.GetInstance().player.IsPass=IsPass; GlobalScript.GetInstance().player.Isreverse = Isreverse; //GlobalScript.GetInstance().player.CanSight=CanSight; //GlobalScript.GetInstance().player.CanFire=CanFire; //GlobalScript.GetInstance().player.RankList=new List<Ranklist>(rank); }
public void EnergyChange() { float s = ((float)GlobalScript.GetInstance().player.Energy) / 100.0f; EnergyUi.fillAmount = s * 0.78f; // Debug.Log("ssssss"+s); // if(s==0.79) // { // EnergyF.SetActive(true); // } // else // { // EnergyF.SetActive(false); // } }
// Use this for initialization void Start() { int indexVal = 0; if (Application.loadedLevel == (int)GameLeve.Leve2 || Application.loadedLevel == (int)GameLeve.Leve4) { indexVal = 1; } UITexture uiTextureCom = GetComponent <UITexture>(); uiTextureCom.mainTexture = MapTexture[indexVal]; GlobalScript.GetInstance().ChangeNPCEvent += ChangeNPCEvent; }
public void ShowLotteryCount() { shiUi = shi.GetComponent <UISprite>(); geUi = ge.GetComponent <UISprite>(); if (GlobalScript.GetInstance().player.LotteryCount > 100) { shiUi.spriteName = "c" + 9; geUi.spriteName = "c" + 9; } else { shiUi.spriteName = "c" + GlobalScript.GetInstance().player.LotteryCount / 10; geUi.spriteName = "c" + GlobalScript.GetInstance().player.LotteryCount % 10; } }
// Use this for initialization void Start() { GlobalScript.GetInstance().player.LifeTimeEnd += LifeTimeEnd; GlobalScript.GetInstance().player.IsGameOverChange += IsGameOverChange; // GlobalScript.GetInstance().player.IsPassChange+=IsPassChange; GlobalScript.GetInstance().player.IsreverseChange += IsreverseChange; GlobalScript.GetInstance().player.IsRequestedChange += IsRequestedChange; GlobalScript.GetInstance().player.WaitingRequestChange += WaitingRequestChange; GlobalScript.GetInstance().player.ContinueGame += ContinueGame; GlobalScript.GetInstance().player.CanSightChange += CanSightChange; //GlobalScript.GetInstance().player.AddTennisEvent+=AddTennisEvent; GlobalScript.GetInstance().player.RemoveTennisEvent += RemoveTennisEvent; GlobalScript.GetInstance().player.AddBufferEvent += AddBufferEvent; //GlobalScript.GetInstance().player.SpeedChange+=SpeedChange; }
public IEnumerator Gogo() { if (GlobalData.GetInstance().gameMode == GameMode.OnlineMode && NetworkServerScript != null && NetworkServerScript.GetIsServer()) { yield break; } if (netCtrlScript != null) { ScreenLog.Log("Gogo -> PlayerIntoGameCount " + netCtrlScript.PlayerIntoGameCount + ", CountLinkPlayer " + NetCtrl.CountLinkPlayer); if (netCtrlScript.PlayerIntoGameCount < NetCtrl.CountLinkPlayer) { yield return(new WaitForSeconds(1.0f)); yield return(Gogo()); } } Invoke("playAudioTime", 0.5f); ui.spriteName = "go3"; PlayTween(); yield return(new WaitForSeconds(1)); Invoke("playAudioTime", 0.5f); ui.spriteName = "go2"; PlayTween(); yield return(new WaitForSeconds(1)); Invoke("playAudioTime", 0.5f); ui.spriteName = "go1"; PlayTween(); BikeCamera.bIsAimPlayer = true; yield return(new WaitForSeconds(1)); Invoke("playAudioTime", 0.5f); ui.spriteName = "go"; PlayTween(); //这里添加代码自行车开始可以控制. GlobalScript.GetInstance().player.StartGame(); yield return(new WaitForSeconds(1)); gameObject.SetActive(false); pcvr.OpenGameDongGan(); GuidanceImg.OpenYouMenUI(); }
private void AddTennis() { pos.onFinished.Clear(); if (GlobalScript.GetInstance().player.TennisCount == 0) { pos.to = temp.InverseTransformPoint(wq1.transform.position); EventDelegate.Add(pos.onFinished, delegate { GlobalScript.GetInstance().player.Addtennis(); updataTennisUI(); gameObject.SetActive(false); isFinished = true; }); } else if (GlobalScript.GetInstance().player.TennisCount == 1) { pos.to = temp.InverseTransformPoint(wq2.transform.position); EventDelegate.Add(pos.onFinished, delegate { GlobalScript.GetInstance().player.Addtennis(); updataTennisUI(); gameObject.SetActive(false); isFinished = true; }); } else if (GlobalScript.GetInstance().player.TennisCount == 2) { pos.to = temp.InverseTransformPoint(wq3.transform.position); EventDelegate.Add(pos.onFinished, delegate { GlobalScript.GetInstance().player.Addtennis(); updataTennisUI(); gameObject.SetActive(false); isFinished = true; }); } else if (GlobalScript.GetInstance().player.TennisCount > 2) { pos.to = temp.InverseTransformPoint(wq3.transform.position); EventDelegate.Add(pos.onFinished, delegate { updataTennisUI(); gameObject.SetActive(false); isFinished = true; }); } scale.PlayForward(); pos.PlayForward(); }
public void CanSightChange() { //Debug.Log("222222222222"+GlobalScript.GetInstance().player.CanSight); if (GlobalScript.GetInstance().player.CanSight) { // Vector3 v= camera1.camera.WorldToScreenPoint(player.transform.position); // //Vector3 v1=camera2.camera.ScreenToWorldPoint(v); // FireUi.transform.localPosition=new Vector3(v.x-camera2.camera.pixelWidth/2.0f,v.y-camera2.camera.pixelHeight/2.0f,0); FireUi.SetActive(true); FireUi.GetComponent <Fire>().playTween(); } else { GlobalScript.GetInstance().player.CanFire = false; FireUi.SetActive(false); } }
public void CanFireChange() { if (gameObject.activeSelf) { if (GlobalScript.GetInstance().player.CanFire) { pcvr.FireLightState = LedState.Shan; transform.GetChild(0).GetComponent <UISprite>().spriteName = "ZhunXingLv"; } else { pcvr.FireLightState = LedState.Mie; //Debug.Log("2222222222222222"); transform.GetChild(0).GetComponent <UISprite>().spriteName = "ZhunXingHong_1"; } } }
void onFinishedTweenPos() { //ScreenLog.Log("onFinishedTweenPos -> caiPiao"); // if(GlobalData.GetInstance().IsOutputCaiPiao) // { // if(pcvrScript == null) // { // GameObject pcvrObj = GameObject.Find("_PCVR"); // pcvrScript = pcvrObj.GetComponent<pcvr>(); // //ScreenLog.Log("caiPiao find pcvr"); // } //// pcvrScript.setPrintCardNum( GlobalScript.GetInstance ().player.LotteryCount ); // } GlobalScript.GetInstance().Invoke("ShowFinalRank", 2f); EventDelegate.Remove(tweenPosScript.onFinished, onFinishedTweenPos); }
public IEnumerator Keep(string name) { yield return(new WaitForSeconds(2)); if (name == "dianchi") { do { yield return(new WaitForSeconds(0.2f)); } while (GlobalScript.GetInstance().player.Energy > 0f); dianchiUI.enabled = false; } else { wangqiuUI.enabled = false; } }
// Use this for initialization void Start() { GlobalScript.GetInstance().ShowFinalRankEvent += ShowFinalRankEvent; //UISpriteScript = GetComponent<UISprite>(); UITextureCom = GetComponent <UITexture>(); GameTextType gameTextVal = GlobalData.GetGameTextMode(); if (gameTextVal == GameTextType.Chinese) { TextureArray = TextureArrayCh; } else { TextureArray = TextureArrayEn; } TweenPosScript = GetComponent <TweenPosition>(); RankTran = transform; }
void ClickFireBtEvent(ButtonState val) { //ScreenLog.Log("FireScripts::ClickStartBtEvent -> val " + val); if (val == ButtonState.DOWN) { return; } if (GlobalScript.GetInstance().player.wangQiuTran != null) { hand = GlobalScript.GetInstance().player.wangQiuTran; } if (hand == null) { ScreenLog.LogWarning("ClickFireBtEvent -> mei you shou!"); return; } if (isFire) { return; } //if(true) //test if (GlobalScript.GetInstance().player.CanFire) { if (GlobalData.GetInstance().gameMode == GameMode.OnlineMode) { bikeNetUnity bikeNet = npc.GetComponent <bikeNetUnity>(); if (bikeNet != null) { bikeNet.playFireAction(); } } else { AniScript.PlayAnimation(PlayerAniEnum.fire, 1f); } StartCoroutine(Fire()); GlobalScript.GetInstance().player.RemoveTennis(); isFire = true; } }
// Update is called once per frame void Update() { if (isStart) { dre = new Vector3(0, 0, -622) - transform.localPosition; roa = Vector3.zero - transform.localEulerAngles; transform.localPosition += (dre * Time.deltaTime / duation); transform.localEulerAngles += (roa * Time.deltaTime / duation); //Debug.Log(dre.x+"y"+dre.y+"z"+dre.z); if (dre.magnitude < 1) { isStart = false; GlobalScript.GetInstance().ShowCaipiao(); //GlobalScript.GetInstance().ShowFinalRank(); } //isStart=false; } }
public void Back() { if (GlobalScript.GetInstance().player.LotteryCount > 0) { //ScreenLog.Log("caiPiao Back test..."); Invoke("Back", 2f); return; } if (GlobalData.GetInstance().gameMode != GameMode.OnlineMode) { bike.resetBikeStaticInfo(); } else { bikeNetUnity.resetBikeStaticInfo(); } Invoke("loadStartLevel", 3.0f); }
public IEnumerator AddScore() { int s = (int)kind; while (s > 0) { //Debug.Log("AddScore -> score " + s); if (s > 10) { GlobalScript.GetInstance().player.Score += 10; } else { GlobalScript.GetInstance().player.Score += s; } s -= 10; yield return(new WaitForSeconds(0.0001f)); } }
IEnumerator rainContrl() { if (bikeScript == null) { yield break; } //Debug.Log("rainContrl -> init"); if (GlobalScript.GetInstance().player.IsPass) { RainObj.SetActive(false); StopCoroutine("rainContrl"); yield break; } float time = 0f; bool isIntoSuiDao = bikeScript.GetIsIntoSuiDao(); if (isPlayRain && !isIntoSuiDao) { isPlayRain = false; RainObj.SetActive(true); time = Random.Range(60f, 90f); } else { isPlayRain = true; RainObj.SetActive(false); time = Random.Range(20f, 50f); } yield return(new WaitForSeconds(time)); if (RainObj.activeSelf) { RainObj.SetActive(false); StopCoroutine("rainContrl"); yield break; } yield return(StartCoroutine("rainContrl")); }
//FixedUpdate //LateUpdate void FixedUpdate() { if (GlobalScript.GetInstance().player.IsPass) { return; } if (mBikePlayer == null) { //ScreenLog.Log("BikeCameraNet -> mBikePlayer is null"); return; } if (bikeScript.GetIsIntoSuiDao()) { isPlayRain = true; RainObj.SetActive(false); } setCameraPos(); }
public void addScoreBaoGuo() { if (Network.peerType != NetworkPeerType.Disconnected) { return; } if (Time.realtimeSinceStartup - ScoreTime >= 0.03f) { ScoreTime = Time.realtimeSinceStartup; if (BaoGuoScore > 10) { GlobalScript.GetInstance().player.Score += 10; } else { GlobalScript.GetInstance().player.Score += BaoGuoScore; } BaoGuoScore -= 10; } }
IEnumerator checkBakeAudio() { if (NetworkServerScript.GetIsServer()) { yield break; } if (bakeAudio.Length <= 0) { yield break; } if (!Go.IsStartGame) { yield return(new WaitForSeconds(1.0f)); yield return(checkBakeAudio()); } if (!AudioSourceObj.isPlaying && !MusicUiObj.activeSelf) { playBakeAudio(); MusicUiObj.SetActive(true); yield return(new WaitForSeconds(2f)); MusicUiObj.SetActive(false); } if (GlobalScript.GetInstance().player.IsPass) { //Debug.Log("stop background audio"); AudioSourceObj.Stop(); StopCoroutine("checkBakeAudio"); yield break; } yield return(new WaitForSeconds(1)); yield return(StartCoroutine("checkBakeAudio")); }
void Start() { GameTextType gameTextVal = GlobalData.GetGameTextMode(); GlobalScript.GetInstance().ShowTishiEvent += ShowTishiEvent; //ui = GetComponent<UISprite> (); UiTextureCom = GetComponent <UITexture> (); if (gameTextVal == GameTextType.Chinese) { TextureArray = TextureArrayCh; } else { TextureArray = TextureArrayEn; UiTextureCom.mainTexture = TextureArray[0]; } tween = GetComponent <TweenPosition> (); trans = gameObject.transform; oldduation = tween.duration; //speed = Mathf.Abs (to.x - from.x) /tween.duration; }
IEnumerator Bianse() { float s = 1.0f; while (s >= 0) { s -= Time.deltaTime / duation; //material.SetFloat("_Saturation",s); //Texcure.GetComponent<UITexture>().MarkAsChangedLite(); //Texcure.GetComponent<UITexture>().enabled=false; //Texcure.GetComponent<UITexture>().enabled=true; // Debug.Log("mmmmmmmmmm"); yield return(0); } gameObject.GetComponent <EndPage> ().isStart = true; GlobalScript.GetInstance().ShowEndPage(); GlobalScript.GetInstance().ShowLostTime(); GlobalScript.GetInstance().ShowFinalScore(); IsShootPlayer = true; }
public void SpeedChange() { if ((Application.loadedLevel == (int)GameLeve.Leve3 || Application.loadedLevel == (int)GameLeve.Leve4) && Network.isServer) { return; } if (GlobalScript.GetInstance().player.Speed < 20) { if (!HashowTishi) { GlobalScript.GetInstance().ShowTishi(TishiInfo.Sudu); HashowTishi = true; } } else { HashowTishi = false; } float s = GlobalScript.GetInstance().player.Speed / 60.0f; speedUi.fillAmount = s; //Debug.Log("faguag"+faguangzhe); if (s > 0.75) { speedF.GetComponent <UISprite>().alpha = 1; faguangzhe = true; } else if (faguangzhe) { tweenAlpha1.from = 1; tweenAlpha1.to = 0; tweenAlpha1.ResetToBeginning(); tweenAlpha1.PlayForward(); faguangzhe = false; } }
public IEnumerator Fire() { GameObject newwangqiu = null; yield return(new WaitForSeconds(0.5f)); if (wangqiu) { isFire = false; // GlobalScript.GetInstance().FireTennis(); if (GlobalData.GetInstance().gameMode == GameMode.OnlineMode) { //Debug.Log("test ********* spawn wangQiu"); int playerID = int.Parse(Network.player.ToString()); newwangqiu = (GameObject)Network.Instantiate(wangqiu, hand.position, hand.rotation, playerID); wangQiuAmmoNetScript = newwangqiu.GetComponent <wangQiuAmmoNet>(); if (wangQiuAmmoNetScript != null) { wangQiuAmmoNetScript.setAmmoInfo(npc.name); wangQiuAmmoNetScript.DelayRemoveAmmo(); } } else { newwangqiu = (GameObject)Instantiate(wangqiu, hand.position, hand.rotation); wangQiuAmmoCtrl ammoScript = newwangqiu.GetComponent <wangQiuAmmoCtrl>(); ammoScript.DelayRemoveAmmo(); AniScript.ResetRunActionInfo(); } newwangqiu.rigidbody.useGravity = false; newwangqiu.transform.position = hand.transform.position; Vector3 v = GlobalScript.GetInstance().player.AimPossion - hand.position; newwangqiu.rigidbody.AddForce(v.normalized * wangqiuspeed, ForceMode.Impulse); } }
public IEnumerator Timer() { intToTimerImage(GlobalScript.GetInstance().player.Life); while (GlobalScript.GetInstance().player.Life > 0) { if (Time.timeScale != 1f) { yield return(new WaitForSeconds(1)); continue; } yield return(new WaitForSeconds(1)); GlobalScript.GetInstance().player.Life--; if (GlobalScript.GetInstance().player.Life == 10) { audioTimeDaoJiShi = AudioManager.Instance.audio; audioTimeDaoJiShi.clip = TimeAudio20Miao; audioTimeDaoJiShi.Play(); GlobalScript.GetInstance().ShowTishi(TishiInfo.Daojishi); } else if (GlobalScript.GetInstance().player.Life == 0 || GlobalScript.GetInstance().player.Life > 10 || GlobalScript.GetInstance().player.IsPlayHuanHu) { if (audioTimeDaoJiShi != null) { audioTimeDaoJiShi.Stop(); } } GlobalScript.GetInstance().player.LostTime++; intToTimerImage(GlobalScript.GetInstance().player.Life); } }
// Use this for initialization void Start() { if (Network.peerType != NetworkPeerType.Disconnected) { UISprite deFenSprite = transform.parent.GetComponent <UISprite>(); if (deFenSprite != null) { deFenSprite.enabled = false; } gameObject.SetActive(false); return; } intToImage(0); if (isFinal) { GlobalScript.GetInstance().ShowFinalScoreEvent += ShowFinalScoreEvent; } else { GlobalScript.GetInstance().player.ScoreChange += ScoreChange; GlobalScript.GetInstance().player.AddBufferEvent += AddBufferEvent; } }
void Update() { if (GlobalScript.GetInstance().player.Life <= 0 || CameraShake.GetInstance().bIsOpenCamEffect) { if (!BlurEffectScript.enabled) { BlurEffectScript.enabled = true; if (CameraShake.GetInstance().bIsOpenCamEffect) { BlurEffectScript.iterations = (int)(0.3f * MaxBlurIter); } else { BlurEffectScript.iterations = MaxBlurIter; } } return; } else if (BlurEffectScript.enabled) { BlurEffectScript.enabled = false; BlurEffectScript.iterations = 0; } }