• 首页
  • 动态
  • 案例
  • 引擎社区
  • API
  • 文档
  • 示例
  • 引擎下载

大约有 78 项符合查询结果, 库内数据总量为 30,935 项。 (搜索耗时: 0.0046 秒)

1. 2D灯光与网格 · LayaAir3.3 · 引擎文档 · LAYABOX [ 100%]

... 通过按位或运算组合这些值 将结果赋值给图层遮罩属性 示例代码如下: const { regClass, property } = Laya; @regClass() export class lightTest extends Laya.Script { declare owner: Laya.Sprite; @property({ type: Laya.Sprite }) light1: Laya.Sprite; @property({ type: Laya.Spri...

来源: Laya3.0_文档 发布时间: 20250310

2. 实体组件系统 · LayaAir3.3 · 引擎文档 · LAYABOX [ 98%]

... onDestroy(): void { console.log("Game onDestroy"); } 下面以“2D入门示例”中的一个子弹脚本Bullet.ts为例,讲解生命周期方法,以下是此脚本文件的代码: const { regClass, property } = Laya; /** * 子弹脚本,实现子弹飞行逻辑及对象池回收机制 */ @...

来源: Laya3.0_文档 发布时间: 20250103

3. CommandBuffer · LayaAir3.3 · 引擎文档 · LAYABOX [ 97%]

CommandBuffer文档1.简介2.使用步骤3.使用示例CommandBuffer文档 1.简介 CommandBuffer为渲染命令缓冲区,保存了渲染命令列表。当我们将一些渲染指令添加到CommandBuffer后,可以实现对渲染流程的控制,将这些指令在我们想要的时机进行执...

来源: Laya3.0_文档 发布时间: 20240910

4. 精灵 · LayaAir3.3 · 引擎文档 · LAYABOX [ 94%]

... 接着,就可以在组件脚本中用代码对Sprite进行控制了,示例代码如下: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { //declare owner : Laya.Sprite3D; @property({ type: Laya.Sprite }) public sprite: Laya.Sprite; constructor() { s...

来源: Laya3.0_文档 发布时间: 20250103

5. 3D基础显示对象 · LayaAir3.3 · 引擎文档 · LAYABOX [ 94%]

... 使用 Transform3D 类,可以对3D基础对象做基础变换,代码示例如下: //改变立方体的世界坐标 box.transform.position = new Laya.Vector3(0, 0, 0); //立方体的平移 box.transform.translate(new Laya.Vector3(1, 1, 1)); //立方体的旋转 box.transform.rotate(new Laya.Ve...

来源: Laya3.0_文档 发布时间: 20250103

6. 面板容器组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 93%]

...以开发者可以在Panel下添加一些子节点。需要添加如下的示例代码,实现脚本控制Panel: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { @property({ type: Laya.Panel }) public panel: Laya.Panel; //组件被激活后执行,此...

来源: Laya3.0_文档 发布时间: 20240910

7. 资源加载 · LayaAir3.3 · 引擎文档 · LAYABOX [ 93%]

...((res)=> {/** 不带类型,用于常规的资源 */}); 完整的脚本示例如下: const { regClass, property } = Laya; @regClass() export class LoaderDemo extends Laya.Script { onAwake(): void { this.loadTexture("resources/image/monkey2.png", 500);//需要在resources/image放入相应的...

来源: Laya3.0_文档 发布时间: 20240910

8. 绘制图形 · LayaAir3.3 · 引擎文档 · LAYABOX [ 92%]

...e(x, y, width, height, fillColor, lineColor, lineWidth, percent)); } 代码示例: let sp = new Laya.Sprite(); //画矩形 sp.graphics.drawRect(20, 20, 100, 50, "#ffff00", "#00ff00", 5, false); this.owner.addChild(sp); 示例中的 20,20 是矩形起始点坐标,100是向右的宽度,如果...

来源: Laya3.0_文档 发布时间: 20240910

9. 组件装饰器说明 · LayaAir3.3 · 引擎文档 · LAYABOX [ 92%]

...件脚本,需要在类定义之前使用装饰器的标识@regClass(),示例代码如下所示: const { regClass } = Laya; @regClass() export class Script extends Laya.Script { } 如动图1-1所示,只有使用了上述的这个装饰器标识,开发者自定义的组件脚本才会被IDE...

来源: Laya3.0_文档 发布时间: 20250103

10. 角色控制器 · LayaAir3.3 · 引擎文档 · LAYABOX [ 91%]

...撞分组的话,引擎API的碰撞分组需要将值设置为2的幂。 示例代码如下: //用代码指定xxx碰撞器所属哪个碰撞组 xxx.collisionGroup = 1 << 3 ;// 值为2 的 3 次幂(8),可以简单理解分组ID为3,这样就更容易与IDE中的概念统一 2.2 可...

来源: Laya3.0_文档 发布时间: 20250310