Files
climb/assets/scripts/Shadow2D.ts
richarjiang 70a7c25d99 refactor(scene): 重构影子节点结构并简化Shadow2D组件
- 移除动态创建影子节点的逻辑,改为在场景中预置Shadow节点
- 简化Shadow2D组件,移除target绑定和动态更新逻辑
- 统一所有影子节点的命名和结构,统一使用Shadow名称
- 调整影子节点位置,统一放在角色节点下作为子节点
- 移除所有动态影子参数配置,使用固定椭圆参数绘制影子
2025-09-30 09:31:17 +08:00

12 lines
364 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { _decorator, Component, Graphics, Color } from 'cc';
const { ccclass } = _decorator;
@ccclass('Shadow2D')
export class Shadow2D extends Component {
start() {
let g = this.node.addComponent(Graphics);
g.fillColor = new Color(0, 0, 0, 100); // 半透明黑色
g.ellipse(0, 0, 40, 15); // 椭圆radiusX=40, radiusY=15
g.fill();
}
}