提供游戏配置数据访问属性

This commit is contained in:
dgflash
2022-11-01 15:29:01 +08:00
parent c51a6b8e0b
commit de2a95c48c
2 changed files with 8 additions and 3 deletions

View File

@@ -144,7 +144,7 @@ export class OrbitCamera extends Component {
input.on(Input.EventType.MOUSE_WHEEL, this.onMouseWheel, this);
}
this.resetTargetRotation();
if (this.target) this.resetTargetRotation();
// 根据欧拉角信息计算摄像机四元数,旋转顺序为 YZX
Quat.fromEuler(this._rotation, this._targetRotation.x, this._targetRotation.y, this._targetRotation.z);
@@ -164,7 +164,7 @@ export class OrbitCamera extends Component {
let targetRotation: Vec3 = this._targetRotation.set(this._startRotation);
if (this.followTargetRotationY) {
targetRotation = tempVec3_2.set(targetRotation);
Quat.toEuler(tempVec3, this.target!.worldRotation);
Quat.toEuler(tempVec3, this.target.worldRotation);
targetRotation.add(tempVec3);
}
}

View File

@@ -2,7 +2,7 @@
* @Author: dgflash
* @Date: 2021-07-03 16:13:17
* @LastEditors: dgflash
* @LastEditTime: 2022-09-06 17:29:04
* @LastEditTime: 2022-11-01 15:26:26
*/
import { oops } from "../../core/Oops";
@@ -52,6 +52,11 @@ export class GameConfig {
}
private _data: any = null;
/** 游戏配置数据 */
public get data(): any {
return this._data;
}
constructor(config: any) {
let data = config.json;
this._data = Object.freeze(data);