// Update is called once per frame void Update() { cameracontrol(); powerup(); if (!nothing) { //checkA (); checkJ(); checkW(); } checkspeed(); checkland(); checkhit(); if (Input.GetKey(KeyCode.A) && !leftcheck && !stopusing && !nothing && !animator.GetCurrentAnimatorStateInfo(0).IsName("BreakD") && !animator.GetCurrentAnimatorStateInfo(0).IsName("Dash") && !animator.GetCurrentAnimatorStateInfo(0).IsName("Attack1") ) { animator.SetBool("run", true); animator.SetBool("stand", false); animator.SetBool("breakr", false); left(); rightcheck = false; if (!animator.GetCurrentAnimatorStateInfo(0).IsName("AirAttack")) { this.transform.localScale = new Vector3(-0.1f, 0.1f, 1f); } } if (Input.GetKey(KeyCode.D) && !rightcheck && !stopusing && !nothing && !animator.GetCurrentAnimatorStateInfo(0).IsName("BreakD") && !animator.GetCurrentAnimatorStateInfo(0).IsName("Dash") && !animator.GetCurrentAnimatorStateInfo(0).IsName("Attack1") ) { animator.SetBool("run", true); animator.SetBool("stand", false); animator.SetBool("breakr", false); right(); leftcheck = false; if (!animator.GetCurrentAnimatorStateInfo(0).IsName("AirAttack")) { this.transform.localScale = new Vector3(0.1f, 0.1f, 1f); } } if (Input.GetKey(KeyCode.Space) && !stoprush && !nothing) { if (count1 == 0) { if (skc.sp > 2) { skc.DoRushSkill(); } dogetime = skc.rushlevel; DogedList.Clear(); } count3 = 0; stopusing = true; animator.SetBool("fall", false); if (!landcheck) { skc.jumptime = 0; } if (rightcheck || leftcheck) { animator.SetBool("rush", false); animator.SetBool("breakd", true); } if (this.transform.localScale.x > 0 && !rightcheck && this.transform.position.x < 113.5) { if (count1 == 0) { if (skc.sp > 2) { skc.sp = skc.sp - 2; } else { count1 = 36; count2 = 36; stoprush = true; stopusing = false; } } if (count1 < 35) { count1++; animator.SetBool("rush", true); animator.SetBool("breakd", false); character.constraints = RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation; } else if (count1 == 35) { animator.SetBool("rush", false); if (landcheck) { animator.SetBool("breakd", true); } else if (!landcheck) { animator.SetBool("fall", true); } character.constraints = RigidbodyConstraints2D.FreezeRotation; } if (count2 < 10) { count2++; Movespeed1 += 0.3f * skc.movespeed; transform.Translate(Vector3.right * Movespeed1); } else if (count2 <= 35 && count2 >= 10) { count2++; transform.Translate(Vector3.right * 3f * skc.movespeed); Movespeed1 = 0.3f * skc.movespeed; } leftcheck = false; } else if (this.transform.localScale.x < 0 && !leftcheck && this.transform.position.x > -24.5) { if (count1 == 0) { if (skc.sp > 2) { skc.sp = skc.sp - 2; } else { count1 = 35; count2 = 36; stoprush = true; stopusing = false; } } if (count1 < 35) { count1++; animator.SetBool("rush", true); animator.SetBool("breakd", false); character.constraints = RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation; } else if (count1 == 35) { animator.SetBool("rush", false); if (landcheck) { animator.SetBool("breakd", true); } else if (!landcheck) { animator.SetBool("fall", true); } character.constraints = RigidbodyConstraints2D.FreezeRotation; } if (count2 < 10) { count2++; Movespeed1 += 0.3f * skc.movespeed; transform.Translate(Vector3.left * Movespeed1); } else if (count2 < 35 && count2 >= 10) { count2++; transform.Translate(Vector3.left * 3f * skc.movespeed); Movespeed1 = 0.3f * skc.movespeed; } rightcheck = false; } else if (this.transform.position.x > 113.5 || this.transform.position.x < -24.5) { animator.SetBool("rush", false); animator.SetBool("breakd", true); } } if (Input.GetKeyUp(KeyCode.Space)) { count1 = 0; count2 = 0; Movespeed1 = 0.3f * skc.movespeed; if (!landcheck) { animator.SetBool("fall", true); } else { animator.SetBool("breakd", true); } animator.SetBool("rush", false); stopusing = false; stoprush = true; } //恢复冲刺功能的条件判断 if (stoprush && !Input.GetKey(KeyCode.Space)) { if (animator.GetCurrentAnimatorStateInfo(0).IsName("Stand") && !animator.IsInTransition(0)) { stoprush = false; } if (animator.GetCurrentAnimatorStateInfo(0).IsName("Run") && !animator.IsInTransition(0)) { stoprush = false; } if (animator.GetCurrentAnimatorStateInfo(0).IsName("Landing")) { stoprush = false; } } //跳跃次数的重制 if (animator.GetCurrentAnimatorStateInfo(0).IsName("Landing")) { skc.jumptime = skc.jumplevel; } if (Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.D)) { animator.SetBool("run", false); if (count < 0) { animator.SetBool("breakr", true); count = 30; } else if (count > 0) { animator.SetBool("stand", true); count = 30; } } }