Esempio n. 1
0
 public CharacterSelector(int startIndex, Dictionary <int, GameObject> components,
                          TransitionHandlerInterface[] transitionHandlers,
                          ElementPressedHandler[] pressedHandler,
                          CharacterSelectionHelper selectionHelper, CharacterMenuManager menuManager, bool initialFocus)
     : base(startIndex, components, transitionHandlers, pressedHandler, initialFocus)
 {
     this.selectionHelper = selectionHelper;
     this.menuManager     = menuManager;
 }
    private void GatherNeededReferences()
    {
        //getting all the character menu manager scripts
        GameObject[]         go = GameObject.FindGameObjectsWithTag("CharacterMenuManager");
        CharacterMenuManager characterMenuManager;

        if (go != null)
        {
            for (int i = 0; i < go.Length; i++)
            {
                characterMenuManager = go[i].GetComponent <CharacterMenuManager>();
                characterMenuManager.SetMenuInputActive(false);
                slots.Add(new SlotContainer(characterMenuManager, null));
            }
            SortSlots();
        }
        else
        {
            Debug.LogError("No CharacterMenuManager found!");
        }


        //getting the player selection container
        GameObject g1 = GameObject.FindGameObjectWithTag("GlobalScripts");

        if (g1 != null)
        {
            playerSelectionContainer = g1.GetComponent <PlayerSelectionContainer>();
            if (playerSelectionContainer == null)
            {
                Debug.LogError("No PlayerSelectionContainer found!");
            }
        }
        else
        {
            Debug.LogError("No Global Scripts GameObject found!");
        }

        //getting the character selection helper
        GameObject g2 = GameObject.FindGameObjectWithTag("CharacterMenuHelper");

        if (g2 != null)
        {
            characterSelectionHelper = g2.GetComponent <CharacterSelectionHelper>();
            if (characterSelectionHelper == null)
            {
                Debug.LogError("Chracter Selection Helper is null!");
            }
        }
        else
        {
            Debug.LogError("No Character Selection GameObject found!");
        }
    }