preface
In the game, the death of a character is usually triggered after the HP goes to zero, and then some character actions and animations will be matched for rendering, such as the model falling down, splitting, adding particle effects, and HUD will add a display information to remind the character of death.Copy the code
The body of the
Design death as a skill trigger
It usually takes an injury to trigger a death sentenceCopy the code
Param design
classDiagram
class CharacterMaster{
Boolean isKilled;
Boolean PlayKilled;
Boolean KilledEnd;
}
Logic design
Graph TD character death --> set PlayKilled to true character death --> Set isKilled to True Set PlayKilled to true --> Trigger Blueprint animation death state Trigger Blueprint animation death state --> Play particle notification after a certain period of time Play particle notification after a certain period of time --> Set particle effects play particle animation trigger blueprint animation death state --> Play notification after a certain period of time --> Set PlayKilled to false set PlayKilled to false --> End death action broadcast
Animation design
Death action
I'm still doing motion debugging in Blender, which is a lot of time at the moment, and when I do it at the same time, I have a lot of problems because I'm not familiar with the designCopy the code
Material and particle effects
Reference B station BV1yz4y1U77Q the elder brother is very detailed, is the video transition is very scaryCopy the code
Materials and Parameters
The whole thing looks like thisCopy the code
Material core logic
Using the characteristics of mask, the transparency of both ends of the If and Substract combination to achieve the value range, at the same time, the value of a part of the range of pixels to display or disappearCopy the code
Mask part
This part is responsible for missing pixelsCopy the code
Light emitting part
The luminous range needs to be used in conjunction with the mask. The luminous range should be limited to the middle sectionCopy the code
Carry out the assignment of self-luminous colorCopy the code
Panner
Panner is often used for UV displacement to achieve dynamic effects. The Speed parameter is essentially a 2D value, representing the XY coordinate offsetCopy the code
The image provides a certain amount of randomness (it feels like a rose in the middle of nowhere)Copy the code
Its system
A simplified particle systemCopy the code
Cover character surface
Start the gravity
You can float particlesCopy the code
The particle color
Animation is bound to particle effects
Callers and corresponding operations
Animation calls the notificationCopy the code
The character accepts the action and sets the particle effectCopy the code
Animate in TICK
Determines the particle animation start condition
Parameter control to achieve animation keyframe effect
Hiding instead of dying
It's not a good idea to destroy ACTOR without checking to hide it from wild Pointers and other messy situationsCopy the code
The final result
After 10 small punches, HP returns to zero and plays the death animation like it did before playing destructorCopy the code
The next one is about designing towers. Towers are essentially like peopleCopy the code