Example #1
0
    public void FlyToUI()
    {
        m_fShowEffectCounter = 0.6f;
        Vector3       pos = Vector3.zero;
        CombatInfoWnd Wnd = WndManager.FindDialog <CombatInfoWnd>();

        if (Wnd != null)
        {
            if (m_type == ResourceType.Gold)
            {
                pos = m_uicamera.WorldToViewportPoint(Wnd.GetResourcePos(m_type).position);
            }
            else if (m_type == ResourceType.Wood)
            {
                pos = m_uicamera.WorldToViewportPoint(Wnd.GetResourcePos(m_type).position);
            }
        }
        pos.z -= m_gameCamera.transform.position.z / 2;


        pos = m_gameCamera.ViewportToWorldPoint(pos);
        //str += "," + pos;
        pos = m_gameCamera.transform.InverseTransformPoint(pos);
        //pos.y -= 0.5f;
        transform.parent = m_gameCamera.transform;
        //	Debug.Log(str);
        gameObject.transform.DOMove(pos, 1f);
        //Debug.DrawLine(transform.position,pos);
    }
Example #2
0
    public override void Start()
    {
        base.Start();
        if (m_type == ResourceType.Wood)
        {
            SoundPlay.Play("battle_wood_pick", false, false);
        }
        else if (m_type == ResourceType.Gold)
        {
            SoundPlay.Play("gold", false, false);
        }

        //m_fShowEffectCounter = 0.4f;
        Vector3       pos = Vector3.zero;
        CombatInfoWnd Wnd = WndManager.FindDialog <CombatInfoWnd>();

        if (Wnd != null)
        {
            pos = m_uicamera.WorldToViewportPoint(Wnd.GetResourcePos(m_type).position);
        }
        pos.z = 20;//Mathf.Abs(m_target.transform.position.z - m_gameCamera.transform.position.z) * 0.5f;
        pos   = m_gameCamera.ViewportToWorldPoint(pos);
        m_end = m_gameCamera.transform.InverseTransformPoint(pos);
        m_target.transform.parent = m_gameCamera.transform;
        m_start = m_target.transform.localPosition;
        m_target.transform.localScale = Vector3.one;
        EffectCamera.RemoveFollowList(m_target.transform);
    }
Example #3
0
 void SetEffect()
 {
     if (m_type == ResourceType.Gold)
     {
         CombatInfoWnd Wnd = WndManager.FindDialog <CombatInfoWnd>();
         if (Wnd != null)
         {
             Transform parent           = Wnd.GetResourcePos(m_type);
             GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", "2000301", parent.position, parent);
             if (gae != null)
             {
                 GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(0.5f);
                 gae.AddAction(ndEffect);
             }
         }
     }
     else if (m_type == ResourceType.Wood)
     {
         CombatInfoWnd Wnd = WndManager.FindDialog <CombatInfoWnd>();
         if (Wnd != null)
         {
             Transform parent           = Wnd.GetResourcePos(m_type);
             GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", "2000311", parent.position, parent);
             if (gae != null)
             {
                 GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(0.5f);
                 gae.AddAction(ndEffect);
             }
         }
     }
 }