以Y为例
弧度点 ----------------相对中心点位置
cocos 引擎提供了 更加简洁的方法
Vec3.rotateY(this._offset, this._pointA, this._centerPoint, nextStation * Math.PI / 180);
最关心的当属小车的移动
车子 在 x 和z轴移动
小车旋转Y
private _arrivalStation(){
this._pointA.set(this._pointB);
this._currRoadPoint = this._currRoadPoint.nextStation.getComponent(RoadPoint);
if (this._currRoadPoint.nextStation) {
this._pointB.set(this._currRoadPoint.nextStation.worldPosition);
if (this._isMain) {
if (this._isBraking) {
this._isBraking = false;
CustomEventListener.dispatchEvent(EventName.END_BRAKING);
}
if (this._currRoadPoint.type === RoadPoint.RoadPointType.GREETING) {
this._greetingCustomer();
} else if (this._currRoadPoint.type === RoadPoint.RoadPointType.GOODBYE) {
this._takingCustomer();
} else if (this._currRoadPoint.type === RoadPoint.RoadPointType.END) {
AudioManager.playSound(Constants.AudioSource.WIN);
this._runState = RunState.OVER;
this._minSpeed = this._maxSpeed = 0.2;
this._currSpeed = this._minSpeed;
this._acceleration = 0;
CustomEventListener.dispatchEvent(EventName.GAME_OVER);