preface

The good news is that when it comes to generating individual units, the source video supports 1080P, so it's easy to watch. The effect is to generate units anywhere on the map and click to see their HUD.Copy the code

Began to speak!

Resource SPAWN BP <SPAWN translated to SPAWN >

Start at the beginning with the MASTERCopy the code

Resource unit < TA that changes randomly with each instance >

First, the resource unit is logically an ACTOR blueprint with MESH attached random variablesCopy the code

It started to change after I edited itCopy the code

The effect is very similar to that of the particle system in Blender. Random numbers are very different.Copy the code

Resource unit generation area

The core is to do a ray detection, hit the terrain and start generating corresponding actors.Copy the code

I set the ResourceType Param to generate a reference to MasterBP for the random resource mentioned above. You can do anything you want. And then you're going to set a LocalCounts variable to be exposed so that once you've generated a fixed number of units you're going to make a cube range with the boundary, random dots, and ray counts.Copy the code

Add timer generation resource < TICK Tick Birth >

In order to implement the combination of timer and game time, we need to build on the previous # I'm Starting the Sun is Turning. That is, GameState and PlayController get the corresponding time-dependent GameSpeedModifier variable and hitch a ride from GameState to bind it to its bomberman dispatcher called Update GameSpeedCopy the code

The first step is to get the reference objects of GameState and PlayController under the current setting. The second step is to bind the DISPATCHER to call the reset timer whenever the game time speed changes. The game time speed change needs to be connected to the previous time HUD.Copy the code

Look like this, slow down stop acceleration, that's what the three white keys tell you.Copy the code
Graph of TD GameTimeHUD - > GameState Dispatcher: GameSpeedController - > SourceSpawnBp: custom events: GetGameSpeed

The switch between game time and real time supported in the original video is set with enumCopy the code

This piece is at the end of the BeginPlay sequenceCopy the code

Following the regional resource generation above, it can be independently used to generate a single resourceCopy the code

Character unit spawns < artificial artificial man >

NAME, SEX, AGE, BIRTHDAYCopy the code

Decide your gender at birth

The MATERIAL instance here is used for subsequent MATERIAL coloring to distinguish genderCopy the code

STRUCT is used to store data in the original video. It is the same as the break in the previous picture that pulled down a long film. At the same time, I made a first name distinction and gave a cheap sticker along the way. The texture type is SLATE, not imageCopy the code

Decide on your birthday after you’re born

The GAME TIME is set in GameState and requires a GameState ref to call the corresponding function. Of course, if you are born on February 29th, there will be a BUGCopy the code

Mom calls for you on your birthday

Set Dispatcher in GameStateCopy the code

At the same time, the SetCalender Function in the original GameState needs to modify the add pointCopy the code

Then bind the generated PAWN to itCopy the code

CheckBirthday = dayUpdate>0Copy the code

Press V to give birth

So now I need to go back to the PlayController and put in both the Input and Camera functions. Call the POSITION data Spawn ACTOR and you're done. The red circle decal below the character needs to be viewed in the original videoCopy the code

Character data view < noon has arrived biubiubiu>

The overall difficulty is the interaction between the HUD and the UnitMasterCopy the code

Create HUD of character information < Zhang SAN Hospital show sheet >

Set up character information link < Blood test person >

Remember to expose the outgoing link as soon as possibleCopy the code

Go back to the PlayController and add the ref informationCopy the code

You asked me where the ref was set and marked when giving birthCopy the code

That's pretty much what the character HUD Settings meanCopy the code

PlayController for Dispatcher Settings < tap blood >

Go back to the character generating ACTOR binding in the UnitMasterCopy the code

Custom event where ==self is doing a little bit of a checkup and then calling the HUD and tying its own data to it and that's all right, so the unitRef here needs to be set in BeginPlayCopy the code

The last exposed interface was tied up and the data workedCopy the code

conclusion

Give birth to one and see for yourselfCopy the code