Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Single Player Menu
  4. Single Player Manager

Single Player Manager

The Map Manager component is the main component in a single player menu. 

When creating a single player menu using the RTS Engine menu editor, this component is attached to an object called “SinglePlayerManager”.


General:

  1. Main Menu Scene: The name of the scene that you want the player to get back to from the the single player menu.
  2. Min Population: The minimum amount of population slots to start with.

Maps & Factions: 

  1. Maps: This array holds all the map’s information that the player can choose from:
    1. Map Scene: Name of the map’s scene.
    2. Map Name: Name of the map to show in the UI menu.
    3. Map Description: When a map is selected, this description is displayed.
    4. Max Factions: Maximum amount of factions that this map supports.
    5. Faction Types: A list of Faction Type Info assets that define the possible faction types that can play in the map.
  2. Allowed Colors: A list of the colors that a faction is allowed to have.
  3. NPC Manager: An array that holds the NPC Manager components that can be chosen for NPC factions in the single player menu. Each element presents a difficulty level.

UI Settings:

In this part, UI elements of the single player menu that are not fields in the Map Manager component will be discussed.

  1. Map Menu: The Map Menu represents the part of the Single Player UI Menu that handles map’s selection. When creating a single player menu using the RTS Engine menu editor, this menu is represented by the “MapMenu” object and its children:
    1. Map Description (Map Manager field): A UI Text that shows the selected map’s description.
    2. Map Max Factions (Map Manager field): A UI Text that shows the selected map’s maximum allowed amount of factions.
    3. Map Drop Down Menu (Map Manager field): A UI Dropdown that allows the player to pick a map from a list of possible options. In the “On Value Changed” event of the “Dropdown” component, drag and drop the object that has the Map Manager script as the event source and set the event to Map Manger -> “UpdateMap”.
    4. Start Game Button: A UI Button. In the “On Click” event of the Button component, drag and drop the object that has the Map Manager component as the event source and set the event to Map Manager -> “StartGame”.
  2.  Factions Menu: The Factions Menu represents the part of the Single Player UI Menu that handles adding/removing factions and setting each faction’s name, difficulty level and color. When creating a single player menu using the RTS Engine menu editor, this menu is represented by the “FactionsMenu” object and its children:
    1. Faction UI Parent (Map Manager field): UI object, parent of all the objects that have the Factions UI Info component. Each child object represents a faction slot.
    2. Add Faction Button: A UI Button that allows the player to add a NPC faction to play.  In the “On Click” event of the Button component, drag and drop the object that has the Map Manager component as the event source and set the event to Map Manager -> “AddFaction”.
    3. Faction UI Info (Map Manager field): A child object of the “Faction UI Parent”, that has the Faction UI Info component attached to it. This represents a faction slot and holds all the information of the faction (color, name, population, etc). This object will be used a sample as it will be duplicated to the number of the faction that the player chooses. In the Single Player UI Menu, a Faction UI Info sample object is provided, that object itself is composed of a UI elements as its child objects: 
      1. Color Img: A UI Button that is used to display the faction’s color. In the “On Click” event of the Button component, drag and drop the Faction UI Info object as the event source and set the event to Faction UI Info -> “ChangeColor”.
      2. Faction Name Input: A UI Inputfield that is used to input and sow the faction’s name. In the “On End Edit” event of the “InputField” component, drag and drop the Faction UI Info object as the event source and set the event to Faction UI Info -> “OnFactionNameChange”.
      3. Population Input: A UI Inputfield that is used to input/show the faction’s initial amount of population slots. In the “On End Edit” event of the “InputField” component, drag and drop the Faction UI Info object as the event source and set the event to Faction UI Info -> “OnPopulationChange”.
      4. Difficulty Menu: UI Dropdown used to display the difficulty levels as options for the difficulty menu, allowing the player to pick the difficulty level for a NPC faction. In the “On Value Changed” event of the “Dropdown” component, drag and drop the Faction UI Info object as the event source and set the event to Faction UI Info-> “OnDifficultyLevelChange”.
      5. Remove Faction Button: A UI Button. In the “On Click” event of the “Button” component, drag and drop the Faction UI Info object as the event source and set the event to Faction UI Info -> “RemoveFaction”.

Other elements of the Single Player Menu are:

  • Exit Button: In the “On Click” event of the “Button” component, drag and drop the object that has the Map Manager component as the event source and set the event to Map Manager -> “MainMenu”.

How can we help?