Exemple #1
0
    //-----------------------------------------------------------------

    #region Public Methods
    // Constructor, searching and populating variables
    // Plus setting methods for buttons
    public ResultMenuPanelComponent(Menu menu)
    {
        p_ParentMenu = menu;
        PanelObj     = menu.gameObject.transform.Find("ResultMenuPanelComponent").gameObject;
        RectTransform[] trans = PanelObj.GetComponentsInChildren <RectTransform>();
        for (int i = 0; i < trans.Length; i++)
        {
            if (trans[i].name == "RePlayButton")
            {
                m_RePlayButton = trans[i].GetComponent <Button>();
                SetMethod(m_RePlayButton, RePlayGame);
            }
            if (trans[i].name == "ExitButton")
            {
                m_ExitButton = trans[i].GetComponent <Button>();
                SetMethod(m_ExitButton, RePlayGame);
            }
            if (trans[i].name == "YouWon")
            {
                m_YouWon = trans[i].gameObject;
            }
            if (trans[i].name == "YouLost")
            {
                m_YouLost = trans[i].gameObject;
            }
        }
        Init();
    }
    //-----------------------------------------------------------------

    #region Public Methods
    // Constructor, searching and populating variables
    // Plus setting methods for buttons
    public StartMenuPanelComponent(Menu menu)
    {
        p_ParentMenu = menu;
        PanelObj     = menu.gameObject.transform.Find("StartMenuPanelComponent").gameObject;
        RectTransform[] trans = PanelObj.GetComponentsInChildren <RectTransform>();
        for (int i = 0; i < trans.Length; i++)
        {
            if (trans[i].name == "PlayButton")
            {
                m_PlayButton = trans[i].GetComponent <Button>();
                SetMethod(m_PlayButton, PlayGame);
            }
            if (trans[i].name == "ExitButton")
            {
                m_ExitButton = trans[i].GetComponent <Button>();
                SetMethod(m_ExitButton, ExitGame);
            }
        }
    }
    //-----------------------------------------------------------------

    #region Public Methods
    // Constructor, searching and populating variables
    // Plus setting methods for buttons
    public InGamePanelComponent(Menu menu)
    {
        p_ParentMenu = menu;
        PanelObj     = menu.gameObject.transform.Find("InGamePanelComponent").gameObject;
        RectTransform[] trans = PanelObj.GetComponentsInChildren <RectTransform>();
        for (int i = 0; i < trans.Length; i++)
        {
            if (trans[i].name == "TrajectoryUi")
            {
                m_TrajectoryUi = trans[i].gameObject;
            }
            if (trans[i].name == "IndicatorRightPos")
            {
                m_IndicatorRightPos = trans[i].gameObject;
            }
            if (trans[i].name == "IndicatorLeftPos")
            {
                m_IndicatorLeftPos = trans[i].gameObject;
            }
            if (trans[i].name == "CharIcon")
            {
                m_CharDistanceUi = trans[i].gameObject;
            }
            if (trans[i].name == "PowerAmmount")
            {
                m_PowerText = trans[i].GetComponent <TextMeshProUGUI>();
            }
            if (trans[i].name == "AngleAmmount")
            {
                m_AngleText = trans[i].GetComponent <TextMeshProUGUI>();
            }
            if (trans[i].name == "CharDistanceText ")
            {
                m_CharDistanceText = trans[i].GetComponent <TextMeshProUGUI>();
            }
            if (trans[i].name == "PlayerArrow")
            {
                m_PlayerDistanceArrow = trans[i].gameObject;
            }
            if (trans[i].name == "EnemyArrow")
            {
                m_EnemyDistanceArrow = trans[i].gameObject;
            }
            if (trans[i].name == "PlayerIcon")
            {
                m_PlayerDistanceIcon = trans[i].gameObject;
            }
            if (trans[i].name == "EnemyIcon")
            {
                m_EnemyDistanceIcon = trans[i].gameObject;
            }
            if (trans[i].name == "PlayerHealthImage")
            {
                m_PlayerHealthImage = trans[i].GetComponent <Image>();
            }
            if (trans[i].name == "EnemyHealthImage")
            {
                m_EnemyHealthImage = trans[i].GetComponent <Image>();
            }
        }
    }