public void JumpOnGround() { //从平台跌落,设置三段跳(因为跌落后执行,所以在跌落的那一帧,会没来得及设置三段跳,因此在这也设置一次) if (groundDct.isClosedGround == false || (groundDct.isClosedGround && groundDct.disGround > 0)) { //从平台跌落。还可以跳2次。 if (role.state == RoleState.Grounded) { if (role.jumpProc.multijump) { role.jumpProc.remainJumpTimes = 2; } else { role.jumpProc.remainJumpTimes = 1; } } } //起跳条件1 if (InputMgr.Instance.catInput.KeyA.WasPressed) { //print("readyJump"); readyJump = true; } if (InputMgr.Instance.catInput.KeyA.IsPressed) { //起跳条件2 if (readyJump) { //普通跳或二段跳 if (role.groundDct.IsOnGround() && groundDct.IsStandable()) { //print("跳1"); _JumpOnGround(jumpSpeed); } else if (remainJumpTimes > 0) { //print("跳2"); //重置惯性一系统参数 role.moveProc.turnCount = 0; role.moveProc.StaySkyTime = 0; role.moveProc.lastFrameSpeedVector = Vector3.zero; _JumpInTheSky(jumpSpeed, true); } //注意:onIceGround此处属于特殊情况。。。。 } } }
public void UpdateByParent() { if (isActiveAndEnabled == false) { return; } //非上升阶段,处理状态 if (role.state != RoleState.Raising) { if (groundDct.isClosedGround == false || (groundDct.isClosedGround && groundDct.disGround > 0)) { //从平台跌落。还可以跳2次。 if (role.state == RoleState.Grounded) { if (role.jumpProc.multijump) { role.jumpProc.remainJumpTimes = 2; } else { role.jumpProc.remainJumpTimes = 1; } } role.state = RoleState.Falling; } if (groundDct.isClosedGround && groundDct.disGround == 0 && groundDct.IsStandable()) { if (groundDct.slopeLeft < role.maxFrictionSlope && groundDct.slopeRight < role.maxFrictionSlope) { role.state = RoleState.Grounded; fallSpeed = 0; } else { role.state = RoleState.Grounded; } //平稳落于地面 //role.groundDct.OnStandGround(); } } Falling(); //GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Sphere); //obj.transform.position = transform.position; //obj.transform.localScale = Vector3.one * 0.05f; }
public void JumpOnGround() { //从平台跌落,设置三段跳(因为跌落后执行,所以在跌落的那一帧,会没来得及设置三段跳,因此在这也设置一次) SettingJumpTime(); //起跳条件1 if (InputMgr.Instance.catInput.KeyA.WasPressed) { //print("readyJump"); readyJump = true; } if (InputMgr.Instance.catInput.KeyA.IsPressed) { //起跳条件2 if (readyJump) { //普通跳或二段跳 if ((role.groundDct.IsOnGround() && groundDct.IsStandable()) || groundDct.IsOnIceground()) { //print("跳1"); if (groundDct.timeStand >= groundDct.minTimeStand) { //记录滑落方向 role.moveProc.lastSlideVector = role.slideProc.slideVector; _JumpOnGround(jumpSpeed); } } else if (remainJumpTimes > 0) { //print("状态:" + role.state + "," + groundDct.disGround + "," + remainJumpTimes); //特别接近地面时,禁止使用二段跳 //重置惯性 //role.moveProc.ResetInertia(); role.moveProc.ResetTurnLoss(); //记录滑落方向 role.moveProc.lastSlideVector = role.slideProc.slideVector; _JumpInTheSky(jumpSpeed, true); } //注意:onIceGround此处属于特殊情况。。。。 } } }