/// <summary> /// 最佳跳跃方向 /// </summary> /// <returns></returns> public Vector3 PerfectVector() { if (standBlock == null) { return(Vector3.zero); } MyUtil.Orientation o = standBlock.orientation; if (o == MyUtil.Orientation.Forward) { return(new Vector3( 0, 0, standBlock.next.perfect.position.z - transform.position.z )); } else if (o == MyUtil.Orientation.Left) { return(new Vector3( standBlock.next.perfect.position.x - transform.position.x, 0, 0)); } else { return(Vector3.zero); } }
private void JumpByPressTime() { float jumpLength = pressTime * jumpSpeed; Vector3 offset = Vector3.zero; if (standBlock != null) { MyUtil.Orientation o = standBlock.orientation; Vector3 direction = standBlock.direction; offset = direction * pressTime * jumpSpeed; // 当玩家位置不在方块的轴线上时,会根据方向进行对应坐标的纠偏 if (jumpLength >= standBlock.distanceNext()) { if (o == MyUtil.Orientation.Forward) { offset = new Vector3( standBlock.transform.localPosition.x - transform.localPosition.x, offset.y, offset.z); } else if (o == MyUtil.Orientation.Left) { offset = new Vector3( offset.x, offset.y, standBlock.transform.localPosition.z - transform.localPosition.z); } } } else { offset = Vector3.forward; } StartJump(offset); }