import { __SkillData } from "../../../data/sdata/SManage"; import AIBase from "../AI/AIBase"; import FSprite from "../FSprite"; /** * 技能基础属性 */ const {ccclass, property} = cc._decorator; @ccclass export default class SkillBase extends cc.Component { /** * 技能CD时间 */ @property({ displayName: '技能编号' }) public ID:number = 0; /** * 技能CD时间 */ @property({ displayName: '技能CD时间(毫秒)' }) public CD:number = 3000; /** * 技能CD时间 */ @property({ displayName: '有效射程' }) public range:number = 1000; /** * 技能CD时间 */ @property({ displayName: '子弹速度' }) public speed:number = 500; /** * 开始计时 */ public time:number = 0; public sprite:FSprite; public AI:AIBase; /** * 技能数据 */ public _skillData:__SkillData onLoad(){ this.sprite = this.node.getComponent(FSprite); this.AI = this.node.getComponent(AIBase); } /** * 技能是否准备好 */ public ready():boolean{ let dx = new Date().getTime(); if(this.time == 0){ this.time = dx; return false } if(dx - this.time > this.CD){ return true; } return false; } /** * 释放技能 * @target 攻击目标 * @callback 技能结束回调 */ public exe(target:FSprite,callback:()=>void){ } }