nicholas-maltbie / FallingParkour

Multiplayer racing game made with Unity
MIT License
18 stars 3 forks source link

Character Select Screen #7

Open nicholas-maltbie opened 3 years ago

nicholas-maltbie commented 3 years ago

Make a new sub menu in the settings menu for a character select screen. Have this character selection control the avatar loaded for a player.

In the setting menu, dynamically generate a screen that creates a button with a jpg image of each character's face. To dynamically populate these, make a prefab for character selector of a button which has an attached MonoBehaviour (maybe called CharacterSelectorButton) which when created attaches itself to the OnClick action of the button associated with the game object. When a character selects one of the character images, the image should have a green border appear around the button so they know which one they selected. For debug purposes, it might also be nice to load the name of the avatar below or above the button that contains the image for the avatar.

Some kind of visual indicator such as a colored border around whatever the player selects. In order to make a character avatar image associated with each avatar, add a Sprite/Image field called avatarImage to load into the buttons. This can be added to the existing CharacterAvatarLibrary.CharacterAvatar class. This image will have to be created for each of the avatars in instance of CharacterAvatar in the CharacterAvatarLibrary ScriptableObject located at Assets/Prefabs/Player/AvatarLibrary.asset. Images of sprites for each avatar can be found at Assets/Textures/avatars.

The player's selection information should persist by saving the information about the name of the player selection to PlayerPrefs. Then, when the game first loads, if there is a saved avatar selected in PlayerPrefs, the game should load this value to select that given character button as well as set the avatar the player will start with. This should be put on the Awake function so it loads as soon as the UI is created when the game starts up.

When the player selects the button, this needs to work both in game as well as in the main menu. To have this work, when the player presses a button, it should search in the scene for a CharacterAvatarManager that has the isLocalPlayer property set to true. If it is a local player, use the CmdSetAvatar method to change the selected avatar to the name associated with the button. Additionally, the CharacterAvatarManager should use the saved value in PlayerPrefs to load an avatar. This function to load the selected avatar or the default could be abstracted to the CharacterAvatarLibrary class.

nicholas-maltbie commented 3 years ago

need to patch character images so they stack correctly on different resolution screens.