Building an Extensible Multi-Level Transporter
- First was the Display Class.
- This is a component so we can discuss composition.
- It also allowed introduction of the TextRender widget
-
- The Giver class was constructed next.
- This will "give" or add a level to the transporter.
- This assumes that there is only one transporter in the level.
- It has a local variable,
LevelName
- of type
name
- This is exposed, so it can be set by scene builders.
- It also has a ChildActor
- These can be created as described here
- This was a BP_Display
- It needed to set the proper value in the display in the construction script.
-
- On overlap, it attempts to add it's level to the list of destinations for the transporter
-
- Notice this calls member functions
- Elevator.AddLevelName(LevelName)
- Display.NewMessage(LevelName)
- There should probably be some logic here to prevent it from giving the name multiple times.
- And perhaps it should be more strongly tied to the elevator.
- The transporter class
- This has
- A child Actor (Display)
- An array of names (Levels), available to the outside world
- An integer destination.
- There is a major problem with this as it is reset each time we reenter the level.
- We demonstrated this in the end of class.
- We will fix this later.
- The function DisplayDestination is responsible for updating the display
- This is called in the constructor.
- Function AddLevelName allows external items to add a new level
- This takes a level name as a parameter.
- And shows Unreal's AddUnique function
-
- This was called from the Giver
- The function NextDestination
- Increments the destination counter.
- And wraps it back to 0 when needed.
- It also sets the display to the new destination
-
- Finally, on an overlap, the user is transported.
-
- The last item was a BP_DestSwitch
- This is responsible for changing the destination of the transporter
- Again, it works on the first transporter found.
- It has a single operation
-