mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-31 15:09:26 +08:00
feat: 实装天气系统
This commit is contained in:
parent
e1d38ef81b
commit
597333adf7
@ -2894,6 +2894,9 @@ control.prototype.getMappedName = function (name) {
|
||||
////// 更改天气效果 //////
|
||||
control.prototype.setWeather = function (type, level) {
|
||||
// Deprecated. Use WeatherController API instead.
|
||||
const controller = Mota.require('module', 'Weather').controller;
|
||||
controller.clearWeather();
|
||||
if (type !== null && type !== void 0) controller.activate(type, level);
|
||||
};
|
||||
|
||||
////// 注册一个天气 //////
|
||||
|
@ -76,6 +76,7 @@ import { Camera } from './render/camera';
|
||||
import * as Animation from 'mutate-animate';
|
||||
import './render/index';
|
||||
import * as RenderUtils from './render/utils';
|
||||
import '@/module';
|
||||
|
||||
// ----- 类注册
|
||||
Mota.register('class', 'AudioPlayer', AudioPlayer);
|
||||
|
@ -41,6 +41,7 @@ import type { BlockMover, HeroMover, ObjectMoverBase } from './state/move';
|
||||
import type { Camera } from '@/core/render/camera';
|
||||
import type * as Animation from 'mutate-animate';
|
||||
import type * as RenderUtils from '@/core/render/utils';
|
||||
import type { WeatherController } from '@/module/weather/weather';
|
||||
|
||||
interface ClassInterface {
|
||||
// 渲染进程与游戏进程通用
|
||||
@ -140,6 +141,10 @@ interface ModuleInterface {
|
||||
HeroKeyMover: typeof HeroKeyMover;
|
||||
};
|
||||
Animation: typeof Animation;
|
||||
Weather: {
|
||||
controller: WeatherController;
|
||||
WeatherController: typeof WeatherController;
|
||||
};
|
||||
}
|
||||
|
||||
interface SystemInterfaceMap {
|
||||
|
7
src/module/index.ts
Normal file
7
src/module/index.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { controller } from './weather';
|
||||
import { WeatherController } from './weather/weather';
|
||||
|
||||
Mota.register('module', 'Weather', {
|
||||
controller,
|
||||
WeatherController
|
||||
});
|
3
src/module/weather/index.ts
Normal file
3
src/module/weather/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { WeatherController } from './weather';
|
||||
|
||||
export const controller = new WeatherController();
|
@ -36,6 +36,16 @@ export class WeatherController {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 清空所有天气
|
||||
*/
|
||||
clearWeather() {
|
||||
this.active.forEach(v => {
|
||||
v.deactivate();
|
||||
});
|
||||
this.active.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个天气
|
||||
* @param weather 要获取的天气
|
||||
|
@ -21,6 +21,7 @@ import {
|
||||
} from './towerBossProjectile';
|
||||
import { IStateDamageable } from '@/game/state/interface';
|
||||
import { HeroRenderer } from '@/core/render/preset/hero';
|
||||
import { controller } from '@/module/weather';
|
||||
|
||||
Mota.require('var', 'loading').once('coreInit', () => {
|
||||
const shader = new Shader();
|
||||
@ -427,6 +428,8 @@ export class TowerBoss extends BarrageBoss {
|
||||
const skill5Release = this.skill5Time * this.skill5Interval;
|
||||
const attack = this.attackTime * this.attackInterval;
|
||||
|
||||
controller.activate('rain', 6);
|
||||
|
||||
if (time > skill4Release) {
|
||||
this.releaseSkill4();
|
||||
this.skill4Time++;
|
||||
|
Loading…
Reference in New Issue
Block a user