Skip to main content

OculusDestinationController

A class in Root.Township, Alta.PlatformSpecific.Oculus.

Client component that keeps Quest rich presence up to date: the region the player is in, the server deep link and whether there is a free slot. Removes itself on other platforms.

Constructors​

MemberWhat it is
OculusDestinationController()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

2 private and internal fields
MemberWhat it is
private ChunkRegion currentFriendDestinationThe region last sent as the destination.
private static readonly Logger loggerNLog logger for this class.

Properties​

1 private and internal property
MemberWhat it is
private int IBuildRendererBakeable.SortingOrder { get; }Bake order; always 0.

Methods​

13 private and internal methods
MemberWhat it is
private void IBuildRendererBakeable.Bake(bool isSaving)Build bake step; does nothing.
private void IBuildRendererBakeable.Clean()Build clean step; removes the object on non-Quest builds.
private static async Task<bool> HasFreePlayerSlot(int serverId)Asks the Alta API whether the server has fewer players than its limit.
private async void InitializeDeepLinkFromSetup()Sets the deep link to the joined server, marks presence joinable if there's room, and sets the current region.
private void InitializeDeepLinkInvalidTeleportLocation()Before the local player exists: clears the deep link, marks presence not joinable and sets the destination to the main menu.
private bool IsLastDestination(LocationChunk chunk)True if the chunk's region is the one already set.
private static bool IsValidDestination(LocationChunk chunk)True if the chunk exists and has a region other than none.
private void OnDestroy()Unhooks events and clears rich presence on Quest.
private async void OnPlayerCountChanged(Player player)When a player joins or leaves, rechecks free slots and updates joinable presence.
private void SetDestination(ChunkRegion destination)Sets the rich presence destination to a chunk region's name and pushes it.
private void Setup(IPlayer player)Once the local player exists, hooks chunk changes and player join and leave, then sets up the deep link.
private void Start()Destroys itself off Quest; otherwise sets up now or waits for the local player.
private void UpdatePresence(LocationChunk chunk)Sets the destination to the local player's new chunk region if it is valid and changed.