2022-12-16 18:40:57 -06:00
|
|
|
from panda3d.core import *
|
2019-11-02 17:27:54 -05:00
|
|
|
from direct.interval.IntervalGlobal import *
|
2019-12-30 00:07:56 -06:00
|
|
|
from .EffectController import EffectController
|
2019-11-02 17:27:54 -05:00
|
|
|
|
|
|
|
class FlashEffect(NodePath, EffectController):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
NodePath.__init__(self, 'FlashEffect')
|
|
|
|
EffectController.__init__(self)
|
|
|
|
self.fadeTime = 0.15
|
|
|
|
self.effectColor = Vec4(1, 1, 1, 1)
|
|
|
|
model = loader.loadModel('phase_4/models/props/tt_m_efx_ext_particleCards')
|
|
|
|
self.effectModel = model.find('**/tt_t_efx_ext_particleWhiteGlow')
|
|
|
|
self.effectModel.setBillboardAxis(0)
|
|
|
|
self.effectModel.reparentTo(self)
|
|
|
|
self.effectModel.setColorScale(0, 0, 0, 0)
|
|
|
|
self.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingAlpha, ColorBlendAttrib.OOne))
|
|
|
|
self.setBillboardPointWorld()
|
|
|
|
self.setDepthWrite(0)
|
|
|
|
self.setLightOff()
|
|
|
|
self.setFogOff()
|
|
|
|
|
|
|
|
def createTrack(self):
|
|
|
|
fadeBlast = self.effectModel.colorScaleInterval(self.fadeTime, Vec4(0, 0, 0, 0), startColorScale=Vec4(self.effectColor), blendType='easeOut')
|
|
|
|
scaleBlast = self.effectModel.scaleInterval(self.fadeTime, 5, startScale=1.0, blendType='easeIn')
|
|
|
|
self.track = Sequence(Parallel(fadeBlast, scaleBlast), Func(self.cleanUpEffect))
|
|
|
|
|
|
|
|
def setEffectColor(self, color):
|
|
|
|
self.effectColor = color
|