import { _decorator, Component } from 'cc'; const { ccclass, property } = _decorator; /** * 武器方块示例脚本 * 展示如何使用ConfigManager来创建带有武器配置的方块 */ @ccclass('WeaponBlockExample') export class WeaponBlockExample extends Component { private static _instance: WeaponBlockExample = null; // 全局子弹速度(BulletController 会读取) @property({ tooltip: '全局子弹速度(覆盖子弹预制体上的默认值)' }) public bulletSpeed: number = 300; onLoad() { WeaponBlockExample._instance = this; } onDestroy() { if (WeaponBlockExample._instance === this) { WeaponBlockExample._instance = null; } } public static getInstance(): WeaponBlockExample { return WeaponBlockExample._instance; } public getCurrentBulletSpeed(): number { return this.bulletSpeed; } }