-
-
Notifications
You must be signed in to change notification settings - Fork 67
Door
The Door
class is the base class for all doors spawned by the dungeon.
You have to manage yourself how your doors open or close.
For that, you just need to create a child blueprint class of Door
and call the Open
function whenever you want to open or close the door.
You then can do what you want when a door opens or closes by overriding the events OnOpen
and OnClose
(like playing animation, sounds, effects, etc.).
If you want to place walls instead of doors when the rooms are not connected, you still need to inherits your blueprint from the Door
class, but with no logic inside and just a wall static mesh.
You can lock or unlock a door to prevent players from opening the door if you want. You just need to call the Lock
function for that.
The TriggerDoor
class is a Door
which will open or close depending of actors being inside its trigger box.
By default, all Character
actors trigger the door, but you can change this behavior by overriding the IsValidActor
function.
The open/close state of the doors are replicated over the network.
However, you'll need to do your game network logic correctly to make doors work properly in multiplayer.
For example, if you want to make a door that open/close on a player key press, you'll need to send an RPC from your PlayerController
or your controlled Pawn
in order to call your interaction function on you door to open/close it.
(The screen below uses a generic interface to interact with any interactable actor. See the "Good Practice" section below on how to do it)
The screen above uses a custom interface called IInteractable
to generalized the player interaction with whatever actor you want in the game.
This section is not specific to the Door
class of this plugin, but I will explain briefly how to use an interface in Unreal blueprint for those who are not familiar with this concept.
First, you have to create the interface class and populate it with some functions. For the example, I called it IInteractable
(the first I
is a naming convention for interfaces) and I put two functions inside it:
-
CanInteract
which takes anActor
(namedCaller
) in input if I need to check some things before interacting, and returns abool
(true ifCaller
is able to interact). -
Interact
which takes also theCaller
actor as input, and do the actual interaction on theIInteractable
actor.
Remember that you can create any function with any inputs and outputs you want in the interface.
Then you have to add the new interface in your interactable actor settings (the door in my example).
Then, you implement the CanInteract
and the Interact
functions from the interface in your actor.
You can join the Discord server dedicated to this plugin if you want to share, help or ask questions about it.
Installation
Getting Started
Room Architecture
Door
Plugin Settings
Packaging
Dungeon Generator
Choose First Room Data
Choose Next Room Data
Continue To Add Room
Is Valid Dungeon
Occlusion Culling
Door Types
Room Initialization
Room Custom Data
Room Visitor
Room Observer
Console Commands
Multiplayer
Navigation Mesh
Geometry Brushes
If you like my plugin, please consider tipping: