12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import { _decorator, Component, Node, director } from 'cc';
- import { GameController } from '../GameController';
- import { WeaponBase } from '../weapons/WeaponBase';
- import { SkillBase } from './SkillBase';
- const { ccclass, property } = _decorator;
- @ccclass('KillAllMonsterSkill')
- export class KillAllMonsterSkill extends SkillBase {
- constructor(){
- super();
- }
- private weapon:WeaponBase;
- private startTime:number;
- /**
- * 使用技能
- * @param weapon
- */
- UseSkill(weapon:WeaponBase):void{
- this.weapon=weapon;
- this.weapon.fireKey=2;
- this.weapon.MoveFirePosition();
- this.startTime=director.getCurrentTime();
- }
-
- private lastTime:number=0;
- /**
- * 更新
- * @param dt
- */
- Update(dt:number):void{
- let current:number=director.getCurrentTime();
- if(current-this.startTime>this.time){
- this.DispatchEvent(SkillBase.SKILL_COMPLETE);
- return;
- }
- if(current-this.lastTime>this.fireInterval){
- if(GameController.single.leftMonsterList.length){
- this.weapon.fireKey=1;
- }else if(GameController.single.middleMonsterList.length){
- this.weapon.fireKey=2;
- }else{
- this.weapon.fireKey=3;
- }
- this.weapon.MoveFirePosition();
- this.weapon.Fire(false);
- this.lastTime=current;
- }
- }
-
- /**
- * 销毁
- */
- Dispose():void{
-
- }
- }
|