In questo step finale, puoi trovare tutto il codice utilizzato per creare il progetto. Ogni intestazione seguente è il nome del file nel progetto in cui risiede il codice.
Prova a cambiare il codice e a trovare il modo di aggiungere più funzionalità al minigioco. Di seguito sono riportate alcune idee per iniziare:
Aggiungi più livelli da risolvere per il personaggio.
Tieni traccia di quanto tempo ha impiegato il giocatore per risolvere il puzzle o quante mosse ha eseguito il personaggio per livello.
Aggiungi più comandi per il personaggio per creare puzzle più complessi, come ad esempio raccogliere oggetti e posizionarli sul tabellone.
submodules.verse
Il file di progetto submodules.verse imposta il livello di accesso dei sottomoduli e gli asset nel progetto in modo che possano essere utilizzati nel codice Verse. Per maggiori dettagli, vedi lo step 5. Controllo del PNG con la UI] ed esposizione di asset a Verse.
# This file sets the access levels for submodules in the project.
# Specifically, this file is making art assets accessible to the Verse files in the project
# so textures, meshes, and materials can be used in the UI and in the game.
# The submodule Textures.MiniGameUI below is the same as the folder
# Textures/MinigameUI that you can see in the project's Content Browser.
Textures := module:
MiniGameUI<public> := module{}
# The submodule VerseCommander below is the same as the folder
verse_starter_tags.verse
Il file di progetto verse_starter_tags.verse contiene la definizione del tag gameplay verse_commander_minigame_tag che lo script PNG di Verse Commander può utilizzare per trovare il dispositivo minigioco Verse Commander e ascoltarne gli eventi. Per maggiori dettagli, vedi lo step 1. Creazione del comportamento PNG.
# This file contains the Gameplay Tags for the project.
# You can use Gameplay Tags to tag an object in the island
# and be able to query all objects that have the tag during the game using Verse.
using { /Verse.org/Simulation/Tags }
# The verse_commander_minigame_tag is for the Verse Commander Character NPC script
# to be able to find the Verse Commander Minigame device and listen to its events.
verse_commander_minigame_tag := class(tag){}
commands.verse
Il file di progetto commands.verse nel sottomodulo VerseCommander contiene la rappresentazione dei dati di tutti i comandi che può ricevere il PNG. Per maggiori dettagli, vedi lo step 4. Rappresentazione dei dati di comando.
# This file contains the data representation of all the commands that the NPC can receive
# and utilities for the data to help with debugging and troubleshooting issues.
# Each type of command that the NPC can perform will be an instance of this class.
# The class has the unique specifier to make instances of the class comparable.
# The class has the computes specifier to be able to instantiate it at module-scope.
# The class has the abstract specifier so it cannot be instantiated directly, and
# requires subclasses to implement any non-initialized functions, like DebugString().
command := class<computes><unique><abstract>:
DebugString():string
gameboard.verse
Il file di progetto gameboard.verse nel sottomodulo VerseCommander contiene i dati e il comportamento del tabellone di gioco. Per maggiori dettagli, vedi lo step 2. Definizione dei tabelloni per il gioco.
# This file contains the gameboard structure and how it works.
# The gameboard knows where the NPC is supposed to start on the board
# how many obstacles / barriers there are to getting to the end goal,
# and what the end goal is and when it has been reached.
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
# An obstacle on the gameboard, with an associated set of
ui_manager.verse
Il file di progetto ui_manager.verse nel sottomodulo VerseCommander contiene il codice per la creazione e la modifica dell'aspetto della UI. Per maggiori dettagli, vedi lo step 5. Controllo del PNG con UI.
# This file contains all the code to create and modify the UI
# in the Verse Commander minigame.
# The UI for the game contains:
# - Buttons that map to commands for the NPC: forward, turn left, turn right.
# - An execute button that tells the NPC to perform the queue of commands.
# - A remove button that removes the last command added.
# - A reset button that resets the current board and clears out the command queue.
# - A dynamic list of commands that grows wider when a player adds commands and shrinks when a player removes commands.
using { /Fortnite.com/Devices }
verse_commander_minigame.verse
Il file di progetto verse_commander_minigame.verse nel sottomodulo VerseCommander contiene il dispositivo Verse che gestisce il minigioco. Per maggiori dettagli, vedi lo step 6. Gestione del loop di gioco.
# This device is in charge of managing the minigame.
# In its Details panel in the editor, you can:
# - Define how many gameboards there are
# - The order you play the gameboards
# - All the details of the gameboard such as their obstacles.
using { /Fortnite.com/Devices }
using { /Fortnite.com/UI }
using { /UnrealEngine.com/Temporary }
using { /UnrealEngine.com/Temporary/Diagnostics }
verse_commander_character.verse
Il file di progetto verse_commander_character.verse nel sottomodulo VerseCommander contiene la logica Del PNG del minigioco. Per maggiori dettagli, vedi lo step 1. Creazione del comportamento PNG.
# This file handles the logic for the gameboard NPC. The NPC waits for commands from
# verse_commander_minigame, then executes movement based on those commands using navigation targets.
# It also tracks the NPC's position using a visual arrow that updates after each command.
using { /Fortnite.com/AI }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Assets }