Esempio n. 1
0
    // Use this for initialization
    public UINumberSpringEffector(GameObject target, EffectDoneListener listener, Vector3 numberWorldSpawnOffset, float fRamdonSpawnRange, int iDirection)
        : base(target, listener)
    {
        m_guiNumberComp = m_effectNumber.GetComponent <UIPopupElement> ();

        m_UICamera = NGUITools.FindCameraForLayer(LayerMask.NameToLayer("GUI"));

        //m_curSpeed = initSpeed;
        m_spawnOffset = new Vector3(Random.Range(0, fRamdonSpawnRange) + numberWorldSpawnOffset.x, Random.Range(0, fRamdonSpawnRange) + numberWorldSpawnOffset.y, 0f);
        m_iDirection  = iDirection;
    }
Esempio n. 2
0
 void Update()
 {
     for (int iIdx = m_SpringNumbers.Count - 1; iIdx >= 0; iIdx--)
     {
         GameObject number = m_SpringNumbers[iIdx] as GameObject;
         if (number != null)
         {
             UIPopupElement go = number.GetComponent <UIPopupElement> ();
             go.m_effector.Update();
         }
     }
 }
Esempio n. 3
0
    public void DrawUINumberSpring(Vector3 vWorldPos, int iNum, int iDirection)
    {
        GameObject goPopup_elem = _SpawnUINumber(m_resNumber, iNum);

        goPopup_elem.transform.localScale = Vector3.one * m_SpringNumberSize;
        goPopup_elem.transform.parent     = m_NumberRoot.transform;
        UIPopupElement popup_elem = goPopup_elem.GetComponent <UIPopupElement> ();

        if (popup_elem == null)
        {
            return;
        }

        UINumber guiNum = popup_elem as UINumber;

        if (guiNum)
        {
            guiNum.m_fIntervalAdjust = m_SpringNumberIntervalAdjustment;
        }
        popup_elem.m_effector = new UINumberSpringEffector(goPopup_elem, this, m_SpringNumberWorldSpawnOffset, m_SpringRamdonSpawnRange, iDirection);
        UINumberSpringEffector se = popup_elem.m_effector as UINumberSpringEffector;

        //se.m_alpha = m_springEffectorAlpha;
        //se.m_position = m_springEffectorPosition;
        //se.m_scale = m_springEffectorScale;
        se.m_offsetXCurve = m_springEffectorOffsetX;
        se.m_offsetYCurve = m_springEffectorOffsetY;

        se.m_colorRedCurve   = m_springEffectorRed;
        se.m_colorGreenCurve = m_springEffectorGreen;
        se.m_colorBlueCurve  = m_springEffectorBlue;
        se.m_colorAlphaCurve = m_springEffectorAlpha;

        se.m_scaleCurve = m_springEffectorScale;

        se.m_globalNumberSizeAdjust = m_SpringNumberSize;

        Vector3 targetWPos = vWorldPos;

        targetWPos.x += m_SpringNumberPosOffset.x;
        targetWPos.y += m_SpringNumberPosOffset.y;
        targetWPos.z  = 0;

        se.m_numberWorldPos = targetWPos;

        m_SpringNumbers.Add(goPopup_elem);
    }