当前位置: 首页 > news >正文

在线做名片做海报网站关键词排名怎么做好

在线做名片做海报网站,关键词排名怎么做好,兰溪建设局网站,浅谈全球五金网电子商务网站建设定义一个名为ai_dead的类,继承自ai_base类。这个类用于处理游戏中AI在死亡状态下的行为逻辑。以下是对代码的具体解释: 1. **引入基类**: - 使用require函数引入ai_base类,作为基础类。 2. **定义ai_dead类**: …

定义一个名为`ai_dead`的类,继承自`ai_base`类。这个类用于处理游戏中AI在死亡状态下的行为逻辑。以下是对代码的具体解释:

1. **引入基类**:
   - 使用`require`函数引入`ai_base`类,作为基础类。

2. **定义`ai_dead`类**:
   - 使用`class`关键字定义了`ai_dead`类,并继承自`BASE`(即`ai_base`)。

3. **构造函数 (`ctor`)**:
   - 构造函数接受一个`entity`参数,并设置`_type`属性为`eAType_DEAD`,表示死亡的行为。

4. **`IsValid` 方法**:
   - 这个方法用于验证AI是否应该处于死亡状态。它首先调用基类的`IsValid`方法,然后检查实体是否死亡。

5. **`OnEnter` 方法**:

  •      - 当AI组件进入激活状态时执行。如果基类的`OnEnter`方法返回`true`,则执行以下操作:
  •      - 重置`_fadeOut`和`_slowMotion`标志。
  •      - 检查并重置玩家的自动普通攻击状态。
  •      - 隐藏实体的称号节点。
  •      - 检查并重置玩家的超级模式状态。
  •      - 检查并重置骑乘状态。
  •      - 如果实体不是宠物或技能类型,播放死亡动作列表。
  •      - 锁定实体动画。
  •      - 处理同步RPC和发送死亡命令。
  •      - 处理玩家死亡后的界面逻辑,如复活界面和宠物状态。
  •      - 清理死亡实体的仇恨列表和战斗时间。

6. **`OnLeave` 方法**: 当AI组件离开激活状态时执行。如果基类的`OnLeave`方法返回`true`,则解锁实体动画。

7. **`OnLogic` 方法**: 逻辑更新方法。如果基类的`OnLogic`方法返回`true`,则根据时间间隔处理死亡逻辑,如淡出效果、实体销毁等。

8. **创建组件函数**: `create_component`函数用于创建`ai_dead`类的新实例,传入一个实体和一个优先级。

代码中的一些关键点:

  • - `IsDead()`:检查实体是否死亡。
  • - `ShowTitleNode()`:显示或隐藏实体的称号节点。
  • - `SuperMode()`:处理玩家的超级模式。
  • - `OnRideMode()`:处理玩家的骑乘模式。
  • - `PlayActionList()`:播放一系列动作。
  • - `LockAni()`:锁定实体的动画。
  • - `Show()`:控制实体的显示与隐藏。
  • - `Destory()`:销毁实体。
  • - `CanRelease()`:检查实体是否可以释放。

`OnEnter` 方法的逻辑流程:

  • - 调用基类的`OnEnter`方法,如果返回`true`,则继续。
  • - 重置相关动画和攻击状态。
  • - 隐藏称号节点。
  • - 检查并重置超级模式和骑乘状态。
  • - 播放死亡动作列表并锁定动画。
  • - 发送死亡同步命令和处理复活界面逻辑。
  • - 清理仇恨列表和战斗时间。

`OnLogic` 方法中,根据时间间隔处理死亡后的逻辑,如:

  • - 如果实体存活时间超过4秒,并且可以释放,则销毁实体。
  • - 如果实体存活时间超过2秒,并且可以释放,则开始淡出效果。

整体而言,`ai_dead`类的目的是在AI实体死亡时,提供一套标准的行为和逻辑处理,确保游戏内死亡状态的表现和交互符合预期。

local require = requirelocal BASE = require("logic/entity/ai/ai_base").ai_base;------------------------------------------------------
ai_dead = class("ai_dead", BASE);
function ai_dead:ctor(entity)self._type = eAType_DEAD;
endfunction ai_dead:IsValid()if not BASE.IsValid(self) then return false; endreturn self._entity:IsDead();
endfunction ai_dead:OnEnter()if BASE.OnEnter(self) thenself._fadeOut	= false;self._slowMotion= false;local logic = game_get_logic();if logic thenlocal player = logic:GetPlayer();if player and player:GetHero() thenlocal hero = player:GetHero();if hero thenif hero._autonormalattack thenif hero._guid == self._entity._guid thenhero._preautonormalattack = false;hero._autonormalattack = false;elseif self._entity._selected == self._entity._guid thenhero._preautonormalattack = false;hero._autonormalattack = false;elseif hero._follow thenif hero._follow._guid == self._entity._guid thenhero._preautonormalattack = false;hero._autonormalattack = false;endendendendendendself._entity:ShowTitleNode(false);if self._entity:GetEntityType() == eET_Player then--清神兵状态if self._entity._superMode.valid thenlocal hero = game_get_player_hero()if self._entity:IsPlayer() thenself._entity:SuperMode(false)elseself._entity:OnSuperMode(false)endendif self._entity:IsPlayer() theng_game_context:ResetLeadMode()local animation = g_game_context:GetSelectWeaponMaxAnimation()if animation theng_game_context:OnStuntAnimationChangeHandler(animation,false)endend--清骑乘local world = game_get_world()if world and not world._syncRpc thenif self._entity:IsOnRide() thenself._entity:OnRideMode(false, true)endendif self._entity._DIYSkill thenself._entity._DIYSkill:OnReset();endendif self._entity:GetEntityType() ~= eET_Pet and self._entity:GetEntityType() ~= eET_Skill thenlocal alist = {}table.insert(alist, {actionName = db_common.engine.defaultDeadAction, actloopTimes = 1})table.insert(alist, {actionName = db_common.engine.defaultDeadLoopAction, actloopTimes = -1})self._entity:PlayActionList(alist, 1);endself._entity:LockAni(true);local logic = game_get_logic();if logic thenlocal world = logic:GetWorld();if world thenlocal syncRpc = world._syncRpc;if not syncRpc then-- send cmdlocal entity = self._entity;if entity and entity:GetEntityType() == eET_Monster and entity._spawnID > 0 thenlocal weaponID = g_game_context:IsInSuperMode() and 1 or 0local damageRank = g_game_context:GetMapCopyDamageRank()local args = { spawnPointID = entity._spawnID , pos = entity._curPos, weaponID = weaponID, damageRank = damageRank}sbean.sync_privatemap_kill(args)endlocal hero = game_get_player_hero()if hero thenhero:RemoveSummoned();endendendendif self._entity:GetEntityType() == eET_Player thenif logic thenlocal player = logic:GetPlayer()local hero = nilif player thenhero = player:GetHero()endlocal logic = game_get_logic();local world = logic:GetWorld()local PetCount = player:GetPetCount()for i = 1,tonumber(PetCount) dolocal Pet = player:GetPet(i)Pet:OnDead()endif g_db.db_get_is_open_revive_ui() then	if hero._guid == self._entity._guid thenif hero._killerId and hero._killerId < 0 then--天雷复活界面local killerID = math.abs(hero._killerId);local guid = string.split(hero._guid, "|")local playerId = tonumber(guid[2])if killerID == playerId theng_ui_mgr:OpenUI(eUIID_PlayerRevive)g_ui_mgr:RefreshUI(eUIID_PlayerRevive, true)endelseg_logic:OpenReviveUI()end--log("eUIID_PlayerRevive")local MercenaryCount = player:GetMercenaryCount();for i = 1,tonumber(MercenaryCount) dolocal Mercenary = player:GetMercenary(i)Mercenary:OnDead()endendelseif hero._guid == self._entity._guid and (game_get_map_type() == g_ARENA_SOLO or game_get_map_type() == g_TAOIST) theng_game_context:SetAutoFight(false)local MercenaryCount = player:GetMercenaryCount();for i = 1,tonumber(MercenaryCount) dolocal Mercenary = player:GetMercenary(i)if not Mercenary:IsDead() thenlocal camera = logic:GetMainCamera()hero:DetachCamera()Mercenary:AttachCamera(camera);camera:UpdatePos(Mercenary._curPosE);break;endendendendif world and not world._syncRpc thenself._entity:ClsHorseAi();endendendif self._entity._forceAttackTarget thenself._entity._forceAttackTarget = nil;endif self._entity:GetEntityType() == eET_Mercenary thenself._entity._deadTimeLine = g_get_GMTtime(game_get_time())if logic thenlocal player = logic:GetPlayer()local hero = nilif player thenhero = player:GetHero()endlocal logic = game_get_logic();local world = logic:GetWorld()if world._fightmap thenif hero:IsDead() and (game_get_map_type() == g_ARENA_SOLO or game_get_map_type() == g_TAOIST) thenlocal guid1 = string.split(hero._guid, "_")local guid2 = string.split(self._entity._guid, "_")	if tonumber(guid1[2]) == tonumber(guid2[3]) thenlocal MercenaryCount = player:GetMercenaryCount();for i = 1,tonumber(MercenaryCount) dolocal Mercenary = player:GetMercenary(i)if not Mercenary:IsDead() thenlocal camera = logic:GetMainCamera()self._entity:DetachCamera()Mercenary:AttachCamera(camera);camera:UpdatePos(Mercenary._curPosE);break;endendendendendendself._entity:ClsEnmities();endif self._entity:GetEntityType() == eET_Player or self._entity:GetEntityType() == eET_Mercenary thenself._entity:ClearFightTime();endif self._entity:GetEntityType() ~= eET_Player and self._entity:GetEntityType() ~= eET_Mercenary then--self._entity:SetHittable(false);endif self._entity:GetEntityType() == eET_Pet thenlocal world = game_get_world();local player = game_get_player()if world and not world._syncRpc thenif self._entity._hoster thenlocal curFightSP = self._entity._hoster:GetFightSp()self._entity._hoster:UpdateFightSpCanYing(curFightSP - 1)local index = player:GetPetIdx(self._entity._guid)if index > 0  thenplayer:RmvPet(index)endendendendreturn true;endreturn false;
endfunction ai_dead:OnLeave()if BASE.OnLeave(self) thenself._entity:LockAni(false);return true;endreturn false;
endfunction ai_dead:OnLogic(dTick)if BASE.OnLogic(self, dTick) thenif dTick > 0 thenif self._timeTick > 4000 thenif self._entity:CanRelease() thenself._entity:Destory()endelseif self._timeTick > 2000 thenif self._entity:CanRelease() thenif not self._fadeOut thenself._fadeOut = true;self._entity:Show(false, true, 2000);endendendif self._entity:GetEntityType() == eET_Pet or self._entity:GetEntityType() == eET_Skill thenif self._entity:CanRelease() thenself._entity:Destory()endendendreturn true;endreturn false;
endfunction create_component(entity, priority)return ai_dead.new(entity, priority);
end


 

http://www.ds6.com.cn/news/92239.html

相关文章:

  • 《网站建设与管理》方案网络销售是做什么的
  • 如何建个人免费网站深圳网络推广团队
  • 做智能网站系统下载十大门户网站
  • 杭州网站建设方案服务公司智能建站网站模板
  • 婚庆网站开发背景微信运营技巧
  • 织梦网站tag怎么做app拉新推广平台渠道商
  • 如何做外贸soho做网站seo诊断工具网站
  • 专业网站建设集团百度收录网站要多久
  • 手机网站布局教程小红书信息流广告
  • 做一款推荐类的网站seo刷关键词排名软件
  • 利用网盘 建网站推广引流工具
  • wordpress 中文广告插件南阳seo
  • 中山做营销型网站北京网站优化平台
  • 上海建设工程标准与造价信息网站全自动推广引流软件免费
  • 深圳营销型网站建设公司选择哪家好免费浏览网站推广
  • 合作做网站的总结和心得杭州seo推广公司
  • 佛山网站建设多少钱seoer是什么意思
  • 网站建设常规自适应客户关系管理系统
  • 网站设计制作说明东莞互联网公司排名
  • 网站建设改版 gov.cn域名注册服务商
  • 南昌专业网站排名推广湖州网站建设制作
  • 杭州小程序开发定制宁波seo关键词优化报价
  • 专注专业网站建设网站关键词怎样优化
  • 如何申请域名建立网站网站应该如何推广
  • 企业手机端网站模板下载百度爱采购平台登录
  • 单纯做网站的公司郑州seo管理
  • 网站托管套餐win7系统优化大师
  • 鄂州网吧什么时候恢复营业石家庄谷歌seo
  • 建设游戏网站需要什么设备合肥品牌seo
  • 龙岗网站关键词优化代理十种营销方式