예제 #1
0
 public MapRoleInfo(InfoNode vi)
 {
     ID         = vi.GetValueInt("ID");
     RoleID     = vi.GetValueInt("ROLEID");
     RoleType   = vi.GetValueInt("ROLETYPE");
     InitPosX   = vi.GetValueFloat("INITPOSX");
     InitPosY   = vi.GetValueFloat("INITPOSY");
     InitHP     = vi.GetValueInt("CURHP");
     InitStatus = vi.GetValueInt("STATUS");
     IsStatic   = vi.GetValueBool("ISSTATIC");
     CanMove    = vi.GetValueBool("CANMOVE");
     CanControl = vi.GetValueBool("CANCONTROL");
     BaseInfo   = vi;
 }
예제 #2
0
    public ColliderDataNode(InfoNode node)
    {
        name           = node.GetValue("NAME");
        bodyType       = node.GetValueInt("BODYTTYPE");
        bodyCreateType = node.GetValueInt("CREATETYPE");
        string posStr = node.GetValue("POSITION");

        if (!string.IsNullOrEmpty(posStr))
        {
            string[] posArr = posStr.Split(';');
            if (posArr.Length > 1)
            {
                position = new Vector2(float.Parse(posArr[0]), float.Parse(posArr[1]));
            }
        }
        sizeX  = node.GetValueFloat("SIZEX");
        sizeY  = node.GetValueFloat("SIZEY");
        radius = node.GetValueFloat("RADIUS");
        if (bodyCreateType == (int)eBodyCreateType.Polygon)
        {
            string verticesStr = node.GetValue("VERTICES");
            if (!string.IsNullOrEmpty(verticesStr))
            {
                string[] verticesArr = verticesStr.Split('=');
                if (verticesArr.Length > 0)
                {
                    vertices = new List <Vector2>();
                    for (int i = 0; i < verticesArr.Length; i++)
                    {
                        string   verticeStr = verticesArr[i];
                        string[] verticeArr = verticeStr.Split(';');
                        if (verticeArr.Length > 1)
                        {
                            Vector2 vertice = new Vector2(float.Parse(verticeArr[0]), float.Parse(verticeArr[1]));
                            vertices.Add(vertice);
                        }
                    }
                }
            }
        }
        else if (bodyCreateType == (int)eBodyCreateType.Edge)
        {
            string startPosStr = node.GetValue("STARTPOS");
            if (!string.IsNullOrEmpty(startPosStr))
            {
                string[] startPosArr = startPosStr.Split(';');
                if (startPosArr.Length > 1)
                {
                    startPos = new Vector2(float.Parse(startPosArr[0]), float.Parse(startPosArr[1]));
                }
            }
            string endPosStr = node.GetValue("ENDPOS");
            if (!string.IsNullOrEmpty(endPosStr))
            {
                string[] endPosArr = endPosStr.Split(';');
                if (endPosArr.Length > 1)
                {
                    endPos = new Vector2(float.Parse(endPosArr[0]), float.Parse(endPosArr[1]));
                }
            }
        }

        isBreakable   = node.GetValueBool("ISBREAKABLE");
        breakMainName = node.GetValue("BREAKMAINNAME");
        filterType    = node.GetValueInt("FILTERTYPE");
        isActive      = node.GetValueBool("ISACTIVE");

        isSensor   = node.GetValueBool("ISSENSOR");
        speedRatio = node.GetValueFloat("SPEEDRATIO");
        isOneWay   = node.GetValueBool("ISONEWAY");
        string oneWayDirStr = node.GetValue("ONEWAYDIR");

        if (!string.IsNullOrEmpty(oneWayDirStr))
        {
            string[] arr = oneWayDirStr.Split(';');
            if (arr.Length > 1)
            {
                oneWayDir = new Vector2(float.Parse(arr[0]), float.Parse(arr[1]));
            }
        }
        isStuckDir = node.GetValueBool("ISSTUCKDIR");
        string forceDirStr = node.GetValue("FORCEDOR");

        if (!string.IsNullOrEmpty(forceDirStr))
        {
            string[] arr = forceDirStr.Split(';');
            if (arr.Length > 1)
            {
                forceDir = new Vector2(float.Parse(arr[0]), float.Parse(arr[1]));
            }
        }
    }