super-hero/assets/cc-game/scripts/global/GameAssets.ts

44 lines
1.1 KiB
TypeScript

import { SpriteFrame } from 'cc';
import { Prefab } from 'cc';
import { SpriteAtlas } from 'cc';
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('GameAssets')
export class GameAssets extends Component {
// @property(SpriteAtlas) public assetAtlas: SpriteAtlas = null!;
public static instance: GameAssets = null!;
@property(Prefab) heroPrefab: Prefab = null!;
@property(Prefab) creepPrefab: Prefab = null!;
@property(Prefab) activeSkillPrefabs: Prefab[] = [];
@property(Prefab) bossMeleePrefab: Prefab = null!;
@property(Prefab) bossRangePrefab: Prefab = null!;
protected onLoad(): void {
GameAssets.instance = this;
}
public getActiveSkill(type: number): Prefab
{
if (type >= 0 && type < this.activeSkillPrefabs.length)
return this.activeSkillPrefabs[type];
return null;
}
public getBossPrefabById(bossId: string)
{
switch (bossId)
{
case "B1":
return this.bossMeleePrefab;
case "B2":
return this.bossRangePrefab;
}
}
}