Beispiel #1
0
    // ---------
    void ShowCrosshair(E_CrosshairType type, bool forceUpdate = false)
    {
        if ((type == E_CrosshairType.Target) && m_MeleeRange)
        {
            type = E_CrosshairType.TargetMelee;
        }
        else
        {
            type = E_CrosshairType.Normal;             // nechceme zacervenany kurzor
        }
        if ((m_CrosshairType == type) && !forceUpdate)
        {
            return;
        }
        //hide current type
        if (m_CrosshairType != E_CrosshairType.None && m_CrosshairType != type)
        {
            m_Crosshair[(int)m_CrosshairType].Widget.Show(false, true);
            // m_CrosshairHit.Widget.Show(false, false);
        }

        //show new
        if (type != E_CrosshairType.None)
        {
            m_Crosshair[(int)type].Widget.Show(true, true);
        }
        m_CrosshairType = type;
    }
Beispiel #2
0
    // ---------
    protected override bool OnInit()
    {
        if (base.OnInit() == false)
        {
            return(false);
        }

        GUIBase_Pivot pivotMain = MFGuiManager.Instance.GetPivot(s_PivotMainName);

        if (!pivotMain)
        {
            Debug.LogError("'" + s_PivotMainName + "' not found!!! Assert should come now");
            return(false);
        }
        GUIBase_Layout layoutMain = pivotMain.GetLayout(s_LayoutMainName);

        if (!layoutMain)
        {
            Debug.LogError("'" + s_LayoutMainName + "' not found!!! Assert should come now");
            return(false);
        }

        m_EnemyLabel              = layoutMain.GetWidget("EnemyName").GetComponent <GUIBase_Widget>();
        m_EnemyLabelName          = layoutMain.GetWidget("EnemyNameLbl").GetComponent <GUIBase_Label>();
        m_EnemyLabelNameOrigScale = 0.7f;         //m_EnemyLabelName.transform.localScale.x;
        m_EnemyLabelOrigWidth     = m_EnemyLabel.GetWidth();

        m_PrepareForFire  = layoutMain.GetWidget("PrepareForFire").GetComponent <GUIBase_Widget>();
        m_PrepareForFireA = layoutMain.GetWidget("PrepareForFireA").GetComponent <GUIBase_Widget>();
        m_PrepareForFireB = layoutMain.GetWidget("PrepareForFireB").GetComponent <GUIBase_Widget>();

        for (int idx = 0; idx < (int)E_CrosshairType.Max; ++idx)
        {
            if (s_CrosshairName.Length <= idx)
            {
                Debug.LogError("Crosshair names mishmash; there is not any name for " + (E_CrosshairType)idx + " crosshair specified !!!");
                break;
            }
            m_Crosshair[idx] = PrepareSprite(layoutMain, s_CrosshairName[idx]);
        }
        //m_CrosshairTargetChilds = m_Crosshair[(int)E_CrosshairType.Target].GetComponentsInChildren<GUIBase_Widget>();

        m_CrosshairHit          = PrepareSprite(layoutMain, s_CrosshairHit);
        m_CrosshairHitTransform = m_CrosshairHit.transform;
        m_CrosshairType         = E_CrosshairType.None;

        m_MeleeRange = false;

        return(true);
    }
Beispiel #3
0
    protected override void OnDestroy()
    {
        m_CrosshairType = E_CrosshairType.None;

        base.OnDestroy();
    }