PortalManager Class

Summary

PortalManager is a class for handling all portal creation, registration, and linking. This ensures that portal events are propagated across all clients upon success. You do this through PortalManager requests, which allow validation before propagation.
Namespace
ASL.PortalSystem
Base Types
  • MonoBehaviour
graph TD Base0["MonoBehaviour"]-->Type Type["PortalManager"] class Type type-node

Syntax

public class PortalManager : MonoBehaviour

Fields

Name Constant Value Summary
MasterClient
This property tells the PortalManager how to handle events. The master client is the first to receive events, and then propagates them to other clients.
player
This property should be set when the user loads in their avatar. It ensures that portals are initialized with the client avatar, but it is not required to create and use portals.
portalCursor
This property allows you to set the PortalCursor prefab within the editor to enable it's use. Simply leave the property set to null if you do not want to use a PortalCursor.

Methods

Name Value Summary
GetPortal() Portal
Get the Portal component from the portal that the Portal Cursor is touching.
GetPortal(int) Portal
Get the Portal component from a registered portal.
GetPortalIDs() Dictionary<TKey, TValue>.KeyCollection
Get the collection of registered portal IDs.
MakePortal(Vector3, Vector3, Vector3, Portal.ViewType, string) Portal
Instantiate a portal through ASL to ensure it is created for all clients.
RequestLinkPortal(int, int) bool
Request that the given source portal be linked to the given destination portal. Both portals must be registered for successful linking.
RequestLinkPortal(Portal, Portal) bool
Request that the given source portal be linked to the given destination portal. Both portals must be registered for successful linking.
RequestLinkPortal(string, string) bool
RequestRegisterPortal(Portal) bool
Request that the given portal be registered. A portal must be registered before it can be linked.
RequestUnlinkPortal(Portal) bool
Request that the given portal be unlinked from its destination. It must be registered to be linked or unlinked.
RequestUnregisterPortal(Portal) bool
Request that the given portal be unregistered. This would prevent a portal from being linked, and leave it in an idle state.
SetPlayer(GameObject) void
Assign a GameObject as the player to be used by portals managed by the portal manager. Uponsetting the player triggers corresponding local event.