Exemple #1
0
 //服务器同步时,可能已经过了嘲讽时间,使用valid进行判断
 public bool CheckCurrentEvent(short nodeIdx, LinearNodeData sd, bool bValid = true)
 {
     if (m_bEnableEvent == false)
     {
         return(false);
     }
     if (m_NodeIdx != nodeIdx)
     {
         m_NodeIdx = nodeIdx;
         if (bValid)
         {
             if (sd.EventType == (byte)PathEventType.EVENT_STAY)
             {
                 m_EventType = (PathEventType)sd.EventType;
                 m_StayTimes = sd.Times;
             }
             else if (sd.EventType == (byte)PathEventType.EVENT_LAUGH && m_LaughTime != 0)
             {
                 m_EventType = (PathEventType)sd.EventType;
                 m_StayTimes = sd.Times;
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #2
0
        PathLinearInterpolator ReadPathData(BinaryReader br)
        {
            PathLinearInterpolator pi = new PathLinearInterpolator();

            pi.m_WorldMatrix   = Utility.ReadMatrix4x4(br);
            pi.m_WorldRotation = Utility.ReadQuaternion(br);

            pi.m_MaxDistance       = br.ReadSingle();
            pi.m_SampleMaxDistance = br.ReadSingle();
            pi.m_HasPathEvent      = br.ReadBoolean();
            int sampleCount = br.ReadInt32();
            int nodeCount   = br.ReadInt32();

            pi.m_NodeList       = new LinearNodeData[nodeCount];
            pi.m_SplineDataList = new SplineSampleData[sampleCount];
            for (int i = 0; i < nodeCount; ++i)
            {
                LinearNodeData node = new LinearNodeData();
                node.EventType   = br.ReadByte();
                node.Times       = br.ReadUInt16();
                pi.m_NodeList[i] = node;
            }
            m_NodeCount += sampleCount;
            for (int j = 0; j < sampleCount; ++j)
            {
                SplineSampleData node = new SplineSampleData();
                node.pos               = Utility.ReadVec3(br);
                node.rot               = Utility.ReadQuaternion(br);
                node.timeScaling       = br.ReadSingle();
                node.nodeIdx           = br.ReadInt16();
                pi.m_SplineDataList[j] = node;
            }
            return(pi);
        }
Exemple #3
0
    /// <summary>
    /// Assumes that triangles are feed, triples
    /// </summary>
    public LinearOctree(Vector3 position, Vector3 size, Vector3[] points)
    {
        nodes = new List <LinearNode>(points.Length)
        {
            new LinearNode(position, size, 0)
        };

        data = new LinearNodeData[points.Length / 3];

        for (int i = 0; i < data.Length; i++)
        {
            data[i] = new LinearNodeData(points[(i * 3)], points[(i * 3) + 1], points[(i * 3) + 2]);
        }

        uint t = 0;

        for (int i = 0; i < data.Length; i++)
        {
            if (!nodes[0].Add(ref nodes, ref data, i))
            {
                t++;
            }
        }

        Debug.Log(t);
    }