38 lines
1.1 KiB
Plaintext
38 lines
1.1 KiB
Plaintext
|
|
/*
|
||
|
|
文件名:AttackInfoClass.nut
|
||
|
|
路径:User/GameClass/AttackInfoClass/AttackInfoClass.nut
|
||
|
|
创建日期:2024-05-24 09:12
|
||
|
|
文件用途:
|
||
|
|
*/
|
||
|
|
|
||
|
|
class AttackInfo {
|
||
|
|
//配置信息
|
||
|
|
Info = null;
|
||
|
|
//打击列表
|
||
|
|
AttackList = null;
|
||
|
|
|
||
|
|
constructor(Path) {
|
||
|
|
//读取Atk
|
||
|
|
Info = Util.DeepCopy(ScriptData.GetAtk(Path));
|
||
|
|
|
||
|
|
//初始化打击列表
|
||
|
|
AttackList = {};
|
||
|
|
|
||
|
|
// Util.PrintTable(Info);
|
||
|
|
}
|
||
|
|
|
||
|
|
function Attack(Attacker, Damager) {
|
||
|
|
//如果打击列表中没有这个对象才可以打击到
|
||
|
|
if (!AttackList.rawin(Damager.GetId())) {
|
||
|
|
AttackList.rawset(Damager.GetId(), true);
|
||
|
|
|
||
|
|
//设置被打的对象朝向攻击者
|
||
|
|
local DirectionFlag = DIRECTION.LEFT;
|
||
|
|
if (Attacker.X > Damager.X) DirectionFlag = DIRECTION.RIGHT;
|
||
|
|
Damager.SetDirection(DirectionFlag);
|
||
|
|
//如果有推力就设置推力
|
||
|
|
if ("push aside" in Info) Damager.SetXSpeedWithDirection(-(Info["push aside"]));
|
||
|
|
Damager.SetState(BASE_STATE.DAMAGE);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|