super-hero/assets/cc-game/scripts/game_play/hero/ActiveSkill2.ts

36 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-04-19 03:49:41 -07:00
import { _decorator, Component, Node } from 'cc';
import { ActiveSkillBase } from './ActiveSkillBase';
import { UmUtil } from '../../../../cc-common/cc-util/UmUtil';
import { GameGlobalData } from '../../global/GameGlobalData';
import { Vec3 } from 'cc';
import { UmLog } from '../../../../cc-common/cc-util/UmLog';
import { EACTIVE_SKILL_TYPE, GameDefine } from '../../config/GameDefine';
const { ccclass, property } = _decorator;
@ccclass('ActiveSkill2')
export class ActiveSkill2 extends ActiveSkillBase {
euler: Vec3 = new Vec3();
public enableActiveSkill(data, parent) {
super.enableActiveSkill(data, parent);
this.skillType = Number(EACTIVE_SKILL_TYPE.SKILL_2);
this.speed = this.speed / this.useTime;
this.node.setScaleY(this.range);
}
protected update(dt: number): void {
if (!GameGlobalData.Instance.isStatePlay() || this.isDestroying) return;
2024-04-22 01:32:16 -07:00
this.node.position = Vec3.ZERO;
2024-04-19 03:49:41 -07:00
if (this.euler.z <= -360.0) {
this.destroyNode();
return;
}
this.euler.z -= dt * this.speed;
this.node.setRotationFromEuler(this.euler);
}
}