大约有 8 项符合查询结果, 库内数据总量为 31,560 项。 (搜索耗时: 0.0045 秒)
... UniformBuffer 来优化渲染性能。 脚本代码如下: const { regClass, property } = Laya; @regClass() export class Script extends Laya.Script { //共享材质,用于合批 public batchMat: Laya.Material; //颜色数目 private _colorNums = 20; //精灵数目 private _spriteNums = 200; pri...
来源: Laya3.0_文档 发布时间: 20251010
...x、y和z方向上分别移动距离1,示例代码如下: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { @property({ type: Laya.Sprite3D }) public cube: Laya.Sprite3D; // 平移距离 private translate: Laya.Vector3 = new Laya.Vector3(1, 1, 1); cons...
来源: Laya3.0_文档 发布时间: 20251010
组件装饰器标识的详细说明1、识别组件脚本 @regClass()1.1 代码中如何使用 @regClass()1.2 IDE中如何找到被识别的组件脚本2、识别组件 @property()2.1 组件属性的常规使用2.2 访问器的装饰器使用2.3 是否序列化保存 serializable2.4 是否为私...
来源: Laya3.0_文档 发布时间: 20251010
...用等)自动执行相应的方法。 使用示例如下: const { regClass } = Laya; @regClass() export class NewScript extends Laya.Script { //被添加到节点后调用,和Awake不同的是即使节点未激活onAdded也会调用 onAdded(): void { console.log("Game onAdded"); } //组件被...
来源: Laya3.0_文档 发布时间: 20251010
...码 /** * Based upon https://github.com/bgrins/javascript-astar */ export class AStarFindPath { private terrainSprite: MeshTerrainSprite3D; private layaMonkey: Sprite3D; private path: Vector3[]; private _everyPath: any[]; private _position: Vector3 = new Vector3(0, 0, 0); private _upVector3: Vector3...
来源: Laya3.0_文档 发布时间: 20230303
...机添加了这个脚本。 (图6-2) 脚本的代码为: const { regClass, property } = Laya; @regClass() export class CameraMoveScript extends Laya.Script3D { /** @private */ protected _tempVector3: Laya.Vector3 = new Laya.Vector3(); protected lastMouseX: number = 0; protected lastMouseY: num...
来源: Laya3.0_文档 发布时间: 20251010
...的移动,摄像机的位置也同步移动,代码如下: const { regClass, property } = Laya; @regClass() export default class CameraControll extends Laya.Script { @property( { type: Laya.Sprite3D } ) public target: Laya.Sprite3D; private camera: Laya.Camera; public distanceUp: number = 0.5;/...
来源: Laya3.0_文档 发布时间: 20251010
...代码如下: /** * TypeScript语言的3D脚本示例 */ export default class TSDemo extends Laya.Script3D { constructor() { super(); } } 2D脚本与3D脚本不要混用,如果是用IDE创建的脚本模板,需要将继承的2D脚本类(Laya.Script)改为3D脚本类(Laya.Script3D), ...
来源: Laya3.0_文档 发布时间: 20251010