Ejemplo n.º 1
0
    /// <summary>
    /// 手势移动中
    /// </summary>
    /// <param name="gesture"></param>
    public void FingerMove(Vector3 posWorld)
    {
        if (s_bEnableFire == false)
        {
            return;
        }
        if (!PlayerSoldierFire.s_bCollectTouchPoint)
        {
            return;
        }
        if (CmCarbon.IsBorn(soldierDataID))
        {
            return;
        }
        int nTouchCount = m_v3TouchPostions.Count;

        if (nTouchCount > 0)
        {
            Vector3 oldPos = m_v3TouchPostions[m_v3TouchPostions.Count - 1];
            if (NdUtil.V3Equal(posWorld, oldPos))
            {
                return;
            }
        }
        if (isTrace && m_goFingerTrail)
        {
            m_goFingerTrail.transform.position = posWorld;
        }

        if (NdUtil.V3Equal(posWorld, Vector3.zero))
        {
            return;
        }
        m_v3TouchPostions.Add(posWorld);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 收集飞行轨迹
    /// </summary>
    private bool CollectFlyPath(List <Vector3> pos)
    {
        if (pos.Count < 2)
        {
            return(false);
        }
        //收集飞行数据点。
        for (int i = 0; i < pos.Count; i++)
        {
            if (NdUtil.V3Equal(pos[i], Vector3.zero))
            {
                continue;
            }
            FlyDataInfo Info = new FlyDataInfo();
            Info.Pos = new Vector3(pos[i].x, pos[i].y, 0);
            m_lFlyData.Add(Info);
        }
        //
        for (int i = 0; i < m_lFlyData.Count - 1; i++)
        {
            float       Angel = NdUtil.V2toAngle(m_lFlyData[i].Pos, m_lFlyData[i + 1].Pos, Vector3.right);
            FlyDataInfo Info  = m_lFlyData[i];
            Info.FlyDir = new Vector3(0, 0, Angel);
            float Distance = Vector3.Distance(m_lFlyData[i].Pos, m_lFlyData[i + 1].Pos);
            Info.FlyTime  = Distance / m_fSpeed;
            m_Duration   += Info.FlyTime;
            m_lFlyData[i] = Info;
            m_Lastdir     = (m_lFlyData[i + 1].Pos - m_lFlyData[i].Pos).normalized;
        }
        //
        FlyDataInfo Info1 = m_lFlyData[m_lFlyData.Count - 1];

        Info1.FlyDir = m_lFlyData[m_lFlyData.Count - 2].FlyDir;
        m_lFlyData[m_lFlyData.Count - 1] = Info1;
        m_Dir = (m_lFlyData[1].Pos.x - m_lFlyData[0].Pos.x > 0)? WalkDir.WALKRIGHT : WalkDir.WALKLEFT;

        return(true);
    }