void InitZNCM() { AudioAction.ExecuteScript("RemoveAudio,JieShuo.wav"); AudioAction.ExecuteScript("PlayAudio,caimeiji.wav,0.3,0"); AudioAction.ExecuteScript("PlayAudio,posuiji.wav,0.3,0"); AudioAction.ExecuteScript("PlayAudio,biandianzhan.wav,0.3,0"); m_Time = 0; IniMineWall(); IniCutterBra(); float[] sketor = new float[54]; for (int i = 0; i < sketor.Length; i++) { sketor[i] = 0.5f; } ZhengScripts.InitilizeSketator(new Vector2(0, 53), sketor); ZhengScripts.InitilizeSketator(new Vector2(0, 17), new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.5f, 0.5f, 0.5f }); ZhuAnimation.PlayAnimation(new Vector2(0, 17), 0.1f, new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0.05f, 0.1f, 0.15f, 0.2f, 0.25f, 0.3f, 0.35f, 0.4f, 0.45f, 0.5f }, ZhuAnimation.ZhuAnimationMode.Mode3); curStep = typeofStep.None; CMJGo.transform.position = CMJGoPos;//BanChildList[2].transform.position curIndex = 2; KeyFrameAnimation.SSLLJ = true; //斜切入刀 CastTransfrom.singleton.InitilizeAnimation(); if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.CutKnife(); CastTransfrom.singleton.ToLeft(); } }
public void Play(AnimationStateForZMJ[] states) { //BracketAniControlManager.singleton.Play(new Vector2(20, 30), 4f, new List<float>(new float[] { 0.51f, 0.55f, 0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 0.95f, 1f })); //BracketAniControlManager.singleton.Play(new Vector2(20, 30), 4f, new List<float>(new float[] { 0.51f, 0.55f, 0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 0.95f, 1f }), "UpArm"); // AddParticle(); DestroyWall.singleton.control1 = false; DestroyWall.singleton.control2 = false; DestroyWall.singleton.height = 0.9f; CutMineAnimation.singleton.speed = 0.52f; playin = true; firstplay = true; firstplaytime = 20; firstplaysatrttime = Time.time; firstcutterplay = true; firstcutterplaytime = 5; firstcutterplaystarttime = Time.time; rember = states; identification = 0; SlanimationFirst = true; allAnimationOvew = false; zmjZhijiaend = false; result = false; allstop1 = false; pauseAction = null; call1 = false; call2 = false; animationQueue = new Queue <AnimationStateForZMJ>(); for (int i = 0; i < states.Length; i++) { animationQueue.Enqueue(states[i]); } float[] sketor = new float[54]; float[] bracket = new float[54]; float[] uparm = new float[54]; for (int i = 0; i < sketor.Length; i++) { sketor[i] = 0.5f; bracket[i] = 0.5f; uparm[i] = 1; } ZhengScripts.InitilizeBracketAll(new Vector2(0, 53), bracket); ZhengScripts.InitilizeUpArm(new Vector2(0, 53), uparm); ZhengScripts.InitilizeSketator(new Vector2(0, 53), sketor); ZhengScripts.InitilizeBracketAll(new Vector2(0, 11), new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0.2f, 0.3f, 0.4f }); ZhengScripts.InitilizeUpArm(new Vector2(0, 11), new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0.2f, 0.4f, 0.6f, 0.8f }); ZhengScripts.InitilizeSketator(new Vector2(0, 16), new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.5f, 0.5f }); ZhuAnimation.PlayAnimation(new Vector2(0, 16), 0.1f, new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0.05f, 0.1f, 0.15f, 0.2f, 0.3f, 0.4f, 0.5f, 0.5f, 0.5f }, ZhuAnimation.ZhuAnimationMode.Mode3); // if (identification == 1) // { // } }
public static void PlayAnimation(Vector2 index, float time, float[] target, ZhuAnimationMode mode = ZhuAnimationMode.Mode1) { GameObject game = GameObject.Find("Sketator" + (int)index.x); if (game == null) { return; } if (index.y > index.x) { order = true; } else { order = false; } currentIndex = (int)index.x; endIndex = (int)index.y; ZhuAnimation zhu = game.GetComponent <ZhuAnimation>(); if (zhu == null) { zhu = game.AddComponent <ZhuAnimation>(); } zhu.time = time; zhu.mode = mode; if (mode == ZhuAnimationMode.Mode1) { zhu.toTarget = target[0]; targetAAL = target[0]; } if (mode == ZhuAnimationMode.Mode2) { zhu.NormalTimeTarget = target[0]; } if (mode == ZhuAnimationMode.Mode3) { normalTime = new List <float>(target); } }
void PlayNext() { try { if (order) { currentIndex++; } else { currentIndex--; } if (currentIndex <= Fuzhi.mounts && currentIndex >= 0) { if (order ? currentIndex <= endIndex : currentIndex >= endIndex) { ZhuAnimation zhu = GameObject.Find("Sketator" + currentIndex).GetComponent <ZhuAnimation>(); if (zhu == null) { zhu = GameObject.Find("Sketator" + currentIndex).AddComponent <ZhuAnimation>(); } zhu.time = time; zhu.mode = mode; if (mode == ZhuAnimationMode.Mode1) { zhu.toTarget = toTarget + targetAAL; print(zhu.toTarget); } if (mode == ZhuAnimationMode.Mode2) { zhu.NormalTimeTarget = NormalTimeTarget; } } } } catch (System.Exception e) { print(currentIndex + " kk"); } }
void Restart(object obj) { DestroyWall.singleton.control1 = false; DestroyWall.singleton.control2 = false; leftArmAni.Play("New State"); leftArmAni.Update(0); rightArmAim.Play("New State"); rightArmAim.Update(0); isFirst = true; InitZNCM(); IntilizeZJParticle(); Cutter2DAnimation.singleton.SwitchScenceInitilize(); for (int i = 0; i < maxNUM; i++) { GameObject go = GameObject.Find("Sketator" + i); ZhuAnimation zhu = go.GetComponent <ZhuAnimation>(); if (zhu != null) { Destroy(zhu); } } }
void CMJMove() { m_Time += Time.deltaTime; if (isFirst && m_Time >= 3f) { leftArmAni.CrossFade("LeftArm_DH", 0f); rightArmAim.CrossFade("RightArm_DH", 0f); isFirst = false; m_Time = 0f; curStep = typeofStep.step1; Training.TrainingManager.ExecuteScript("SkipVRCamera,ZNCM_TZ"); MovieAction.ExecuteScript("PLayMovie,ZJ_JK,JX_ZJCZ.ogg,0"); MovieAction.ExecuteScript("PLayMovie,CMJ_JK,JX_CMJCZ.ogg,0"); MovieAction.ExecuteScript("PLayMovie,JKZX_JK,JX_JKCZ.ogg,0"); MovieAction.ExecuteScript("PLayMovie,ZJ_JK2,JX_ZJJK.ogg,0"); MovieAction.ExecuteScript("PLayMovie,CMJ_JK2,JX_CMJJK.ogg,0"); MovieAction.ExecuteScript("PLayMovie,JKZX_JK2,JX_JKJK.ogg,0"); AudioAction.ExecuteScript("SetAudioState,caimeiji.wav,3.2:0:-53.3,90,0.3,0"); AudioAction.ExecuteScript("SetAudioState,posuiji.wav,-46.77:0:-27.49,40,0.3,0"); AudioAction.ExecuteScript("SetAudioState,caimeiji.wav,56.5:-0.88:9.11,50,0.3,0"); if (Cutter2DAnimation.singleton != null) { Cutter2DAnimation.singleton.InitilizeAll(CMJGo.transform.Find("CMJ1/CMJ").gameObject); } } if (curStep == typeofStep.step1 && m_Time >= 4.2f) //第一次割煤 { //yield return new WaitForSeconds(4.2f); if (curIndex <= 18) { distance = (CMJGo.transform.position - BanChildList[curIndex].transform.position).magnitude; CMJGo.transform.forward = BanChildList[curIndex].transform.position - BanChildList[curIndex - 1].transform.position; //Vector3 Dir = BanChildList[curIndex].transform.position - BanChildList[curIndex - 1].transform.position; //CMJGo.transform.forward = Vector3.Lerp(CMJGo.transform.forward, Dir, Time.deltaTime); CMJGo.transform.Translate(CMJGo.transform.forward * CMJSpeed * Time.deltaTime, Space.World); if (distance <= 0.4f) { Cutter2D(curIndex); curIndex++; MyEventSystem.DispatchEvent("BeginMove", curIndex); } } else { CastTransfrom.singleton.LeftArmDown(); CastTransfrom.singleton.RightArmUp(); curStep = typeofStep.step2; m_Time = 0f; //割三角煤 ZhuAnimation.PlayAnimation(new Vector2(16, 0), 0.5f, new float[] { 0.5f }, ZhuAnimation.ZhuAnimationMode.Mode2); if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.MiddleVisible(false); CastTransfrom.singleton.HintVisible(false); Cutter2DAnimation.singleton.StopCutter1SecondStageAnimation(); Cutter2DAnimation.singleton.StopCutter2SecondStageAnimation(); } leftArmAni.CrossFade("LeftArm_DHR", 0f); rightArmAim.CrossFade("RightArm_DHR", 0f); if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.CutTri(); CastTransfrom.singleton.ToRight(); } } } else if (curStep == typeofStep.step2 && m_Time >= 4.2f) //第二次割煤--割三角煤 { //yield return new WaitForSeconds(4.2f); if (curIndex >= 3) { distance = (CMJGo.transform.position - BanChildList[curIndex - 1].transform.position).magnitude; CMJGo.transform.Translate(-CMJGo.transform.forward * CMJSpeed * Time.deltaTime, Space.World); if (curIndex == 15) { if (Cutter2DAnimation.singleton.playing) { Cutter2DAnimation.singleton.StartCutter2ThirdStageAnimation(); } } //Debug.Log(distance); if (distance <= 0.4f) { SetGroup1Particle(curIndex + 5); SetGroup2Particle(curIndex - 4); curIndex--; MyEventSystem.DispatchEvent("Step2", curIndex); } } else { CastTransfrom.singleton.LeftArmUp(); CastTransfrom.singleton.RightArmDown(); if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.MiddleVisible(false); CastTransfrom.singleton.HintVisible(false); Cutter2DAnimation.singleton.StopCutter2ThirdStageAnimation(); } //割底煤 leftArmAni.CrossFade("LeftArm_DH", 0f); rightArmAim.CrossFade("RightArm_DH", 0f); if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.ToLeft(); CastTransfrom.singleton.CutDown(); } curStep = typeofStep.step3; m_Time = 0f; } } else if (curStep == typeofStep.step3 && m_Time >= 4.2f)//第三次割煤--割底煤--中部跟机 { //yield return new WaitForSeconds(4.2f); if (curIndex < BanChildList.Count - 1) { distance = (CMJGo.transform.position - BanChildList[curIndex].transform.position).magnitude; CMJGo.transform.Translate(CMJGo.transform.forward * CMJSpeed * Time.deltaTime, Space.World); //Debug.Log(distance); if (distance <= 0.4f) { SetGroup1Particle(curIndex - 3); SetGroup2Particle(curIndex - 3 + 9); curIndex++; //中部跟机 if (curIndex == 19) { //SetDT_YJQDTextContent("中部跟机"); if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.FollowMiddle(); Cutter2DAnimation.singleton.StartCutter1ThirdStageAnimation(); } } if (curIndex == 20) { ZhuAnimation.PlayAnimation(new Vector2(curIndex - 20, curIndex - 11), 0.1f, new float[] { 1.0f, 0.95f, 0.9f, 0.85f, 0.8f, 0.75f, 0.7f, 0.65f, 0.6f, 0.55f }, ZhuAnimation.ZhuAnimationMode.Mode3); } if (curIndex > 20 && curIndex % 10 == 0) { ZhuAnimation.PlayAnimation(new Vector2(curIndex - 29, curIndex - 11), 0.1f, new float[] { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.95f, 0.9f, 0.85f, 0.8f, 0.75f, 0.7f, 0.65f, 0.6f, 0.55f }, ZhuAnimation.ZhuAnimationMode.Mode3); //, 1.0f, 0.95f, 0.9f, 0.85f, 0.8f, 0.75f, 0.7f, 0.65f, 0.6f, 0.55f //ZhuAnimation.PlayAnimation(new Vector2(curIndex - 20, curIndex - 11), 0.1f, // new float[] { 1.0f, 0.95f, 0.9f, 0.85f, 0.8f, 0.75f, 0.7f, 0.65f, 0.6f, 0.55f }, ZhuAnimation.ZhuAnimationMode.Mode3); } MyEventSystem.DispatchEvent("Step3", curIndex); } } else { CastTransfrom.singleton.LeftArmDown(); leftArmAni.CrossFade("LeftArm_DHR", 0f); if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.MiddleVisible(false); CastTransfrom.singleton.HintVisible(false); Cutter2DAnimation.singleton.StopCutter1ThirdStageAnimation(); } if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.CutDown(); CastTransfrom.singleton.ToRight(); } curStep = typeofStep.step4; m_Time = 0f; } } else if (curStep == typeofStep.step4 && m_Time >= 4.2f) //第四次割煤--割底煤 { if (curIndex > 42) { distance = (CMJGo.transform.position - BanChildList[curIndex - 1].transform.position).magnitude; CMJGo.transform.Translate(-CMJGo.transform.forward * CMJSpeed * Time.deltaTime, Space.World); if (distance <= 0.4f) { SetGroup1Particle(curIndex + 5); SetGroup2Particle(curIndex - 4); curIndex--; MyEventSystem.DispatchEvent("Step4"); } } else { if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.MiddleVisible(false); CastTransfrom.singleton.HintVisible(false); } curStep = typeofStep.step5; m_Time = 0f; } } else if (curStep == typeofStep.step5 && m_Time >= 0.5f) //第五次割煤--回到待机位 { //yield return new WaitForSeconds(0.5f); if (curIndex < BanChildList.Count - 1) { distance = (CMJGo.transform.position - BanChildList[curIndex].transform.position).magnitude; CMJGo.transform.Translate(CMJGo.transform.forward * CMJSpeed * Time.deltaTime, Space.World); //Debug.Log(distance); if (distance <= 0.4f) { if (curIndex == 47) { ZhuAnimation.PlayAnimation(new Vector2(31, 45), 0.1f, new float[] { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.95f, 0.9f, 0.85f, 0.8f, 0.75f, 0.7f, 0.65f, 0.6f, 0.55f }, ZhuAnimation.ZhuAnimationMode.Mode3); } SetGroup1Particle(curIndex - 3); SetGroup2Particle(curIndex - 3 + 9); curIndex++; MyEventSystem.DispatchEvent("Step5", curIndex); } } else { m_Time = 0f; MyEventSystem.DispatchEvent("ZNCMrestart"); } } }
void Update() { if (SOManager.singleton.currSceneName != "ZNCM_G") { try { if (image == null) { image = Cutter2DAnimation.singleton.mineWallsAll.GetComponent <UnityEngine.UI.Image>(); } if (image != null) { image.enabled = false; } } catch { } } if (!playin) { return; } if (firstcutterplay) { if (Time.time - firstcutterplaystarttime > firstcutterplaytime) { if (SOManager.singleton.currSceneName == "ZNCM") { Training.TrainingManager.ExecuteScript("SkipVRCamera,ZNCM_TZ"); } firstcutterplay = false; GameObject cutter = GameObject.Find(CutMineAnimation.singleton.cutterName); try { PlayCutterArm(); if (Cutter2DAnimation.singleton != null) { Cutter2DAnimation.singleton.InitilizeAll(GameObject.Find("CMJ_ZNCM")); } Debug.LogError("第一次播放割煤动画"); //SetDT_YJQDTextContent("斜切进刀"); if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.CutKnife(); CastTransfrom.singleton.ToLeft(); } CutMineAnimation.singleton.PlayCutterAnimation(CutMineAnimation.singleton.way1, cutter, 1, CutMineAnimation.singleton.speed, 0, () => { Debug.LogError("第一次播放割煤动画结束"); //SetDT_YJQDVisiblity(false); if (Cutter2DAnimation.singleton.playing) { CastTransfrom.singleton.MiddleVisible(false); CastTransfrom.singleton.HintVisible(false); Cutter2DAnimation.singleton.StopCutter1SecondStageAnimation(); Cutter2DAnimation.singleton.StopCutter2SecondStageAnimation(); } ZhuAnimation.PlayAnimation(new Vector2(16, 0), 0.5f, new float[] { 0.5f }, ZhuAnimation.ZhuAnimationMode.Mode2); PlayCutterArm(1); //动画播放完毕时执行的函数 }, index => { Debug.LogError("序列号:" + index); SetGroup1Particle(index - 3 - 1); SetGroup2Particle(index - 3 + 8); if (index == 5) { if (Cutter2DAnimation.singleton.playing) { Cutter2DAnimation.singleton.StartCutter1FirstStageAnimation(); } //Cutter2DAnimation.singleton.control1.AbandonRight(); DestroyWall.singleton.control1 = true; if (Cutter2DAnimation.singleton != null) { Cutter2DAnimation.singleton.SetDescending(true, -2.0f); } //if (Cutter2DAnimation.singleton != null) // Cutter2DAnimation.singleton.SetCutter1(true); //AddParticle(0); } if (index == 8) { Cutter2DAnimation.singleton.StartCutter1SecondStageAnimation(); } if (index == 9) { if (Cutter2DAnimation.singleton.playing) { Cutter2DAnimation.singleton.StartCutter2FirstStageAnimation(); } DestroyWall.singleton.control2 = true; if (Cutter2DAnimation.singleton != null) { Cutter2DAnimation.singleton.SetDescending(true, 1.3f); Cutter2DAnimation.singleton.SetCutter1(true); } //AddParticle(1); } if (index == 9) { Cutter2DAnimation.singleton.scalecutterrotation = 1f; //Cutter2DAnimation.singleton.control1.AbandonLeft(); } if (index == 13) { //Cutter2DAnimation.singleton.control1.AbandonRight1(); } if (index == 13) { if (Cutter2DAnimation.singleton.playing) { Cutter2DAnimation.singleton.StartCutter2SecondStageAnimation(); } if (Cutter2DAnimation.singleton != null) { Cutter2DAnimation.singleton.SetCutter2(true); } } if (index == 14) { DestroyWall.singleton.height = 10; } if (index == 16) { SetGroup2Particle(index - 3 + 9); //if (Cutter2DAnimation.singleton != null) // Cutter2DAnimation.singleton.SetCutter2(true); } }); } catch (System.Exception e) { Debug.LogError("播放采煤机动画时出现错误:" + e.StackTrace); } if (SOManager.singleton.minewall != null) { SOManager.singleton.minewall.SetActive(false); } if (minewallorder) { minewallorder = false; IniMineWall(); IniCutterBra(); } } } if (firstplay) { if (Time.time - firstplaysatrttime > firstplaytime) { firstplay = false; Play(); } } if (playing) { UpdateCutterAniamtion(); if (minewalltime > 0 && Time.time - minewalltime > 2) { minewalltime = -1; if (!minewallorder) { IniMineWall(); IniCutterBra(); } } if (allAnimationOvew) { if (allstop1 && Time.time - allstope1timme > 3) { allstop1 = false; Training.TrainingManager.ExecuteScript("SetLenght,0:16,-0.4:0.6:0.01"); allstope1timme = Time.time; } if (!allstop1 && Time.time - allstarttime > 3) { allAnimationOvew = false; Play(rember); minewalltime = Time.time; } } if (call1 && call2) { call1 = false; call2 = false; if (order) { if (currentIndex.y >= targetIndex.y) { result = true; ani1 = GetAnimation((int)currentIndex.x); ani2 = GetAnimation((int)currentIndex.y); startfirstflattime = Time.time; StartTimerForCutterAnimation(); return; } currentIndex = new Vector2(currentIndex.x + 1, currentIndex.y + 1); } else { if (currentIndex.y <= targetIndex.y) { result = true; ani1 = GetAnimation((int)currentIndex.x); ani2 = GetAnimation((int)currentIndex.y); startfirstflattime = Time.time; StartTimerForCutterAnimation(); return; } currentIndex = new Vector2(currentIndex.x - 1, currentIndex.y - 1); } if (identification == 3) { if (currentIndex.y == 33) { ZhuAnimation.PlayAnimation(new Vector2(0, 12), 0.1f, new float[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9f, 0.8f, 0.7f, 0.6f }, ZhuAnimation.ZhuAnimationMode.Mode3); MonoBehaviour.print("SLFirst"); } if (currentIndex.y == 47) { ZhuAnimation.PlayAnimation(new Vector2(10, 25), 0.1f, new float[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f }, ZhuAnimation.ZhuAnimationMode.Mode3); MonoBehaviour.print("SLSecond"); } } if (identification == 5) { if (currentIndex.y == 53) { ZhuAnimation.PlayAnimation(new Vector2(21, 44), 0.1f, new float[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f }, ZhuAnimation.ZhuAnimationMode.Mode3); MonoBehaviour.print("SLTirth"); } } //if (currentIndex.x == 6) //{ // DestroyWall.singleton.control1 = true; //} PlayMec(new Vector2(currentIndex.y, currentIndex.x)); } if (result) { if (ani1 != null && ani2 != null) { if (!ani1.playing && !ani2.playing) { if (SlanimationFirst && Time.time - startfirstflattime > distancetime) { SlanimationFirst = false; } // MonoBehaviour.print("pppppppppppppppp"); if (Time.time - zmj.startTime > zmj.stopTime) { result = false; // print(new Vector2(targetIndex.y, targetIndex.x)); Play(); //Play(time, step, distance, new Vector2(targetIndex.y, targetIndex.x), width, actiontime); } } } } if (pauseAction != null) { if (Time.time - pauseStartTime > pauseTime) { pauseAction(); } } } }