private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "player") { bulletTime.ActiveBulletTime(true, BulletTime.BulletTimePriority.BulletTimePriority_High); } }
void Update() { if (active == false) { return; } if (Input.GetMouseButton(1) || (rPlayer != null && rPlayer.GetButton("Dash")) || (playerControl.controlState == PlayerControl1.ControlWay.isMobile && TouchControl.Instance.dashDrag)) { if (m_stateMgr.GetPlayerState() == PlayerStateDefine.PlayerState_Typ.playerState_Idle || m_stateMgr.GetPlayerState() == PlayerStateDefine.PlayerState_Typ.playerState_Jumping) { if (currWaitTime == 0) { AniCom.PlayerDashCharging(); if (m_stateMgr.GetPlayerState() == PlayerStateDefine.PlayerState_Typ.playerState_Jumping) { m_stateMgr.SetPlayerState(PlayerStateDefine.PlayerState_Typ.playerState_Dash); } else if (m_stateMgr.GetPlayerState() == PlayerStateDefine.PlayerState_Typ.playerState_Idle) { m_stateMgr.SetPlayerState(PlayerStateDefine.PlayerState_Typ.playerState_IdleDash); } } else { int a = 0; } } else { if (m_stateMgr.GetPlayerState() == PlayerStateDefine.PlayerState_Typ.playerState_Dash || m_stateMgr.GetPlayerState() == PlayerStateDefine.PlayerState_Typ.playerState_IdleDash) { currWaitTime += 1; } } } if (Input.GetMouseButtonDown(1) || rPlayer.GetButtonDown("Dash")) { playerControl.swap.curr = 0f; } if (Mathf.Abs(rPlayer.GetAxis("MoveHorizontal")) > 0) { int a = 0; } //Debug.Log(Time.timeScale); //播放冲刺情况下的动画 if (isDashing) { //冲刺中动画 //gaidao要求去除这个旋转 //transform.rotation = Quaternion.Euler(0, 0, -AngleBetween(Vector2.up, GetComponent<Rigidbody2D>().velocity)); } bool bChargingDash = false; //Rewired------------------------------------------------------------ if ((Input.GetMouseButton(1) && charge >= 1 && currWaitTime >= waitTime) || (rPlayer.GetButton("Dash") && charge >= 1 && currWaitTime >= waitTime) || (!(playerControl.controlState == PlayerControl1.ControlWay.isKeyboard) && TouchControl.Instance.dashDrag && charge >= 1 && currWaitTime >= waitTime)) { //蓄力粒子 if (_dashChargeParticle == null) { _dashChargeParticle = Instantiate(dashChargingParticle, transform.position, Quaternion.identity, transform); } //显示箭头 if (dashPointer != null) { if (DashPointerShow == true) { Vector2 mouseWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector2 dir = (mouseWorldPos - (Vector2)player.transform.position).normalized; dashPointer.SetActive(true); dashPointer.transform.position = (Vector2)transform.position + dir * 70f; dashPointer.transform.localRotation = Quaternion.Euler(0, 0, -AngleBetween(Vector2.up, dir)); } } playerControl.swap.realWaitTime = playerControl.swap.waitTime; playerControl.targetDeltaTime = Time.fixedDeltaTime; playerControl.targetTimeScale = Time.timeScale; m_bulletTime.ActiveBulletTime(true, BulletTime.BulletTimePriority.BulletTimePriority_High); //辅助线指示 DrawTrajectory(); //播放动态残影 playerControl.SetColShadow(); if (isDashing == false) { if (m_bDashCharging == false) { m_bDashCharging = true; m_fDashLimitChargingTime = 0.0f; } else { m_fDashLimitChargingTime += (Time.deltaTime / Time.timeScale); if (m_fDashLimitChargingTime >= DashLimitChargingTime) { m_bDashCharging = false; m_bulletTime.ActiveBulletTime(false, BulletTime.BulletTimePriority.BulletTimePriority_High); m_bChargeZero = true; playerControl.DashRequestByPlayer(); bChargingDash = true; } } } } //Rewired------------------------------------------------------------ if (Input.GetMouseButtonUp(1) || rPlayer.GetButtonUp("Dash")) { m_bulletTime.ActiveBulletTime(false, BulletTime.BulletTimePriority.BulletTimePriority_High); } if (playerControl.isTouchingGround && bChargingDash == false && isDashing == false) { charge = maxCharge; } }
private void Update() { if (player == null) { return; } Vector2 dashDir = player.GetAxis2DRaw("DashAimHorizontal", "DashAimVertical"); float dashMag = dashDir.magnitude; Vector2 aimDir = player.GetAxis2DRaw("AimHorizontal", "AimVertical"); float aimMag = aimDir.magnitude; if (m_bCancelLock == true) { //aimMag = 0.0f; } if (prevMagnitude > 0 && dashMag == 0) { PlayerControl1.Instance.dash.RequestDash(); } //这里改为,如果瞄准轴被拖动过之后,只要前两桢瞄准的值为0的话,才会执行交换。 //之前一桢判断的话,如果轴在移动到0,0时也会产生交换。 if (m_bAimDrag == true) { if (player.GetButtonUp("CancelLock")) { m_bCancelLock = true; m_bulletTime.ActiveBulletTime(false, BulletTime.BulletTimePriority.BulletTimePriority_High); PlayerControl1.Instance.CancelMarker(true); } if (prevAimMagnitude == 0 && aimMag == 0 && m_fPrevPrevAimMagnitude == 0) { if (m_bCancelLock == false) { PlayerControl1.Instance.swap.Do(); PlayerControl1.Instance.CancelAimBulletTime(); } else { m_bCancelLock = false; } m_bAimDrag = false; } } if (dashMag >= dragStartMag) { finalDashDir = dashDir; dashDrag = true; } else { finalDashDir = player.GetAxis2DRaw("MoveHorizontal", "MoveAimVertical"); dashDrag = false; } if (aimMag >= dragStartMag) { if (m_bCancelLock == false) { m_bAimDrag = true; } finalAimDir = aimDir; aimDrag = true; } else { aimDrag = false; } if (player.GetButtonUp("QuickDash")) { PlayerControl1.Instance.dash.RequestDash(); } if (player.GetButtonUp("QuickSwitch")) { PlayerControl1.Instance.swap.Do(); } prevMagnitude = dashMag; m_fPrevPrevAimMagnitude = prevAimMagnitude; prevAimMagnitude = aimMag; }