This is the class diagram of the UC weapon system, and I will not say every weapon, only the analysis of knives and chargun implementations, because the others are similar.
Ucweapon is the root of the weapon system, it does not do specific things, it only two kinds of behavior, one is baseaction, the other is altaction, to understand the two actions, you can consider the gun. Gun is a weapon that can be both melee and can be far from war, shooting is baseaction, with the butt hit people is altaction, these two actions cannot appear at the same time, so there are
Baseactioninternal and altactioninternal to control, so ucweapon in tick (Update) do one thing, constantly check whether the player can make baseaction and altaction,
Ucweapon's Baseaction
First check the ability to execute weapons baseaction, if you can get the skeleton system of weapons play montage animation, and then perform privatebaseaction, set the length of baseaction, here is focused on why to play montage, At this time because of different weapons action, their animation is different, knife attack time to go forward, gun attack time to have a muzzle on the animation bar, but these only specific subclasses know, Ucweapon will not know
Once you understand ucweapon, you can analyze a simple weapon knife,
When the player left key knife attack, the parent class Ucweapon played the knife animation, the interesting thing happened, UCWEAONKINFE itself is not aware of the player attack this kind of thing, but it is interesting that the knife in the tick event of each frame to check the attack animation of the knife to play,
If there is a play to explain the attack, then this knife can really hurt people? Not necessarily, stab people and knives do not have a half-dime relationship,
To the model of the knife, it can be seen from the hilt to the blagetop hair in a line, if there is something to think it is attack, if the collision to something, and this thing can be converted to bot strange, notify the bot strange, you were attacked, about the AI will be said later If the bot monster fails, it will give it a force, and some damage, if it supports physical effects.
The knife analysis is over.
uc-Weapon System Knife