using UnityEngine;
using TMPro;
///
/// This class manages the user manual popup, including displaying instructions,
/// game mode descriptions, controls, and tips for players.
///
public class UserManualPopup : MonoBehaviour
{
///
/// The panel that contains the user manual popup.
///
public GameObject popupPanel;
///
/// The text element used to display the user manual content.
///
public TextMeshProUGUI userManualText;
///
/// The sprite asset used for embedding icons in the user manual text.
///
public TMP_SpriteAsset combinedSpriteAsset;
///
/// Initializes the user manual content and assigns the sprite asset.
///
private void Start()
{
// Assign the combined sprite asset
userManualText.spriteAsset = combinedSpriteAsset;
// Clear the text
userManualText.text = "";
// Add the header
userManualText.text += "User Manual – How to Play\n\n";
// Add the first section
userManualText.text += "Press the 'Start' Button to enter the main menu.\n";
userManualText.text += "Use on keyboard, or on controller to add your player.\n";
userManualText.text += "Choose your desired gamemode and map.\n";
userManualText.text += "Press 'Begin' to start the match.\n\n";
// Add the "Game Modes" section
userManualText.text += "Game Modes\n\n";
userManualText.text += "Free For All\n";
userManualText.text += "Battle it out with other players.\n";
userManualText.text += "Each player starts with 5 lives.\n";
userManualText.text += "The last player standing wins.\n\n";
userManualText.text += "Obstacle Course\n";
userManualText.text += "Punch and race your way through the course to reach the end.\n";
userManualText.text += "The player who reaches the flag first wins.\n\n";
userManualText.text += "Keep Away\n";
userManualText.text += "Fight for the hat! You get 3 minutes.\n";
userManualText.text += "Touch the hat to start wearing it.\n";
userManualText.text += "You will drop the hat if you are hit or if you died.\n";
userManualText.text += "The player who wears the hat the longest wins.\n\n";
// Add the "Controls" section
userManualText.text += "Controls\n\n";
userManualText.text += "Naviagation: Use Left-Click to select and press to exit\n";
userManualText.text += "Move: / \n";
userManualText.text += "Jump: / / / \n";
userManualText.text += "Punch: / / / \n";
userManualText.text += "Block: \n";
userManualText.text += "Parry: Let go of at the right time\n\n";
// Add the "Tips" section
userManualText.text += "Tips\n\n";
userManualText.text += "Punches seem to hit you harder when you lose health.\n\n";
userManualText.text += "Walk into your opponent to turn them around and push them.\n\n";
userManualText.text += "Time your jumps to avoid falling (or hitting your head).\n\n";
userManualText.text += "The hat has physics too! Don't punch it too hard.";
}
///
/// Displays the user manual popup.
///
public void ShowPopup()
{
popupPanel.SetActive(true);
gameObject.SetActive(true);
print("User manual opened");
}
///
/// Hides the user manual popup.
///
public void HidePopup()
{
popupPanel.SetActive(false);
gameObject.SetActive(false);
print("User manual closed");
}
}