| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- --[[
- author:yzy
- time:2022-04-20 11:16:04
- desc: 怪物石头状态, 就是置灰 设置SetStoneMode 停在动画第一帧
- ]]
- local BuffEntityAnim = require("buff/BuffEntityAnim")
- local BuffEntityStoneMode = class("BuffEntityStoneMode", BuffEntityAnim)
- function BuffEntityStoneMode:ctor(data)
- BuffEntityStoneMode.super.ctor(self, data)
- self._autoRemove = false --强制不自动移除
- end
- function BuffEntityStoneMode:OnEnter()
- BuffEntityStoneMode.super.OnEnter(self)
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- self:disable()
- return false
- end
- if actor:IsMonster() then
- actor:SetStoneMode(true)
- actor:stopAnimToFrame(1)
- else
- self:disable()
- return false
- end
- self:StoneActor()
- end
- function BuffEntityStoneMode:OnExit()
- BuffEntityStoneMode.super.OnExit(self)
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- return nil
- end
- if actor:IsMonster() then
- actor:SetStoneMode(false)
- actor:stopAnimToFrame(nil)
- end
-
- self:UnStoneActor()
- end
- function BuffEntityStoneMode:StoneActor()
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- return nil
- end
- self.isDelayDirty = nil
- local function shaderNode(node)
- self:ShaderStone(node)
- end
- if actor:IsPlayer() then
- local anim = actor:GetAnimation()
- if anim then
- shaderNode(anim)
- end
- anim = actor:GetAnimationWeapon()
- if anim then
- shaderNode(anim)
- end
- anim = actor:GetAnimationShield()
- if anim then
- shaderNode(anim)
- end
- anim = actor:GetAnimationMount()
- if anim then
- shaderNode(anim)
- end
- anim = actor:GetAnimationHair()
- if anim then
- shaderNode(anim)
- end
- elseif actor:IsMonster() then
- local anim = actor:GetAnimation()
- if anim then
- shaderNode(anim)
- end
- elseif actor:IsNPC() then
- local anim = actor:GetAnimation()
- if anim then
- shaderNode(anim)
- end
- end
- end
- function BuffEntityStoneMode:UnStoneActor()
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- return nil
- end
- local function shaderNode(node)
- self:ShaderNormal(node)
- end
- if actor:IsPlayer() then
- local anim = actor:GetAnimation()
- if anim then
- shaderNode(anim)
- end
- anim = actor:GetAnimationWeapon()
- if anim then
- shaderNode(anim)
- end
- anim = actor:GetAnimationShield()
- if anim then
- shaderNode(anim)
- end
- anim = actor:GetAnimationMount()
- if anim then
- shaderNode(anim)
- end
- anim = actor:GetAnimationHair()
- if anim then
- shaderNode(anim)
- end
- elseif actor:IsMonster() then
- local anim = actor:GetAnimation()
- if anim then
- shaderNode(anim)
- end
-
- elseif actor:IsNPC() then
- local anim = actor:GetAnimation()
- if anim then
- shaderNode(anim)
- end
- end
- end
- function BuffEntityStoneMode:ShaderStone(node)
- if not node then
- return
- end
-
- local p = global.GLProgramCache:getGLProgram("ShaderUIGrayScale")
- node:setGLProgram(p)
- end
- function BuffEntityStoneMode:ShaderNormal(node)
- if not node then
- return
- end
- local p = global.GLProgramCache:getGLProgram("ShaderPositionTextureColor_noMVP")
- node:setGLProgram(p)
- end
- function BuffEntityStoneMode:UpdatePresent()
- self:StoneActor()
- end
- return BuffEntityStoneMode
|