重新 使用碰撞来处理 抛射型技能逻辑处理
This commit is contained in:
@@ -1,26 +1,3 @@
|
||||
/**
|
||||
* 这是一个 使用cocos creator 3.8.2引擎 开发的游戏英雄技能系统TS脚本
|
||||
* SkillSet 技能配置表
|
||||
* HeroViewComp 英雄视图组件
|
||||
* HeroSkillsComp 英雄技能组件
|
||||
* Skill 技能实体
|
||||
* SkillCom 技能视图组件
|
||||
* 目前实现功能:
|
||||
* 1. 技能冷却
|
||||
* 2. 技能释放
|
||||
* 3. 技能目标选择
|
||||
* 4. 基础攻击技能的伤害应用 及view的伤害显示
|
||||
* 未完成功能
|
||||
|
||||
|
||||
|
||||
* 1. 技能的动画显示和运动
|
||||
* 2. debuff技能的实现和动画显示
|
||||
* 3. buff技能实现和动画显示
|
||||
*/
|
||||
|
||||
|
||||
|
||||
import { Node, Vec3 } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
@@ -37,6 +14,7 @@ import { AnimType } from "../common/config/SkillSet";
|
||||
/** 技能系统 */
|
||||
@ecs.register('HeroSkillSystem')
|
||||
export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
||||
// export class HeroSkillSystem implements ecs.ISystemUpdate {
|
||||
// private updateInterval: number = 0.1; // 每0.1秒更新一次
|
||||
// private accumulator: number = 0;
|
||||
private _timers: { [key: string]: number } = {};
|
||||
@@ -50,6 +28,7 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
|
||||
|
||||
update(e: ecs.Entity) {
|
||||
return false
|
||||
// 处理伤害队列
|
||||
this.processDamageQueue();
|
||||
const view = e.get(HeroViewComp);
|
||||
@@ -258,18 +237,19 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
const targetView = target.get(HeroViewComp);
|
||||
const skillView = skillEntity.get(SkillCom);
|
||||
if (!casterView || !targetView || !skillView) return;
|
||||
|
||||
|
||||
// 计算距离
|
||||
const distance = this.calculateDistance(
|
||||
skillView.node.position,
|
||||
targetView.node.position
|
||||
);
|
||||
|
||||
// 假设技能效果移动速度为 500 units/second
|
||||
const EFFECT_SPEED = 500;
|
||||
|
||||
// 计算实际延迟时间(秒)
|
||||
const actualDelay = distance / EFFECT_SPEED;
|
||||
|
||||
const actualDelay = distance / (skillView.speed+targetView.speed);
|
||||
console.log("skillView:"+skillView.node.position+ " targetView:"+targetView.node.position+ " actualDelay:"+actualDelay + " dis:"+distance+ " skillView.speed:"+skillView.speed+ " targetView.speed:"+targetView.speed);
|
||||
|
||||
|
||||
this._damageQueue.push({
|
||||
timer: actualDelay,
|
||||
callback: () => {
|
||||
|
||||
Reference in New Issue
Block a user