//撞到球门 public void HitDoor(RunWay runWay) { //door动画 switch (runWay) { case RunWay.Left: DoorAnim.Play("QiuMen_RR"); break; case RunWay.Middle: DoorAnim.Play("QiuMen_St"); break; case RunWay.Right: DoorAnim.Play("QiuMen_LR"); break; } //球网消失 net.SetActive(false); }
//移动 void MovePostion() { //判断切换跑道 switch (m_InputDir) { case InputDirection.NULL: break; case InputDirection.Right: if (targetRunWay < RunWay.Right) { targetRunWay++; m_xDistance = 2; SendMessage("AnimManager", m_InputDir); Game.Instance.Sound.PlayEffect("Se_UI_Huadong"); } break; case InputDirection.Left: if (targetRunWay > RunWay.Left) { targetRunWay--; m_xDistance = -2; SendMessage("AnimManager", m_InputDir); Game.Instance.Sound.PlayEffect("Se_UI_Huadong"); } break; case InputDirection.Up: if (m_cc.isGrounded) { m_yDistance = JumpValue; SendMessage("AnimManager", m_InputDir); Game.Instance.Sound.PlayEffect("Se_UI_Jump"); } break; case InputDirection.Down: if (m_isSlide == false) { m_isSlide = true; m_slideTime = 0.773f; SendMessage("AnimManager", m_InputDir); Game.Instance.Sound.PlayEffect("Se_UI_Slide"); } break; } //切换跑道 if (targetRunWay != nowRunWay) { float move = Mathf.Lerp(0, m_xDistance, MoveSpeed * Time.deltaTime); transform.position += new Vector3(move, 0, 0); m_xDistance -= move; if (Mathf.Abs(m_xDistance) < 0.05) { m_xDistance = 0; nowRunWay = targetRunWay; switch (nowRunWay) { case RunWay.Left: transform.position = new Vector3(-2, transform.position.y, transform.position.z); break; case RunWay.Middle: transform.position = new Vector3(0, transform.position.y, transform.position.z); break; case RunWay.Right: transform.position = new Vector3(2, transform.position.y, transform.position.z); break; } } } //roll滚动计时 if (m_isSlide) { m_slideTime -= Time.deltaTime; if (m_slideTime <= 0) { m_slideTime = 0; m_isSlide = false; } } }