Example #1
0
    public static void CreateMissionPathPointObject(int id, MissionPathPointData data)
    {
        GameObject go = new GameObject();

        // go.name = "MissionPathPoint_" + id;

        go.transform.position = new Vector3(data.pathPoint[0], data.pathPoint[1], data.pathPoint[2]);
        go.transform.Rotate(data.pathPointRotation[0], data.pathPointRotation[1], data.pathPointRotation[2]);

        var collider = go.AddComponent <BoxCollider>();

        collider.size      = new Vector3(data.pathPointSize[0], data.pathPointSize[1], data.pathPointSize[2]);
        collider.isTrigger = true;

        var script = go.AddComponent <MissionPathPointTriggerGear>();

        script.id = id;

        dataGameObjects.Add(id, go);
    }
    public static bool ReloadData(int missionID)
    {
        var xml = XMLParser.Load(string.Concat(SystemConfig.CONFIG_SUB_FOLDER, IMPORT_FILE_PATH, missionID, IMPORT_FILE_EXTENSION, SystemConfig.CONFIG_FILE_EXTENSION));

        if (xml != null)
        {
            var map = XMLParser.LoadIntMap(xml, missionID + IMPORT_FILE_EXTENSION);

            missionPathPoint = new MissionPathPointData[map.Count];

            List<MissionPathPointData> missionPathPointUnsorted = new List<MissionPathPointData>();

            foreach (var node in map)
            {
                MissionPathPointData temp = new MissionPathPointData();

                temp.id = Convert.ToInt32(node.Key);

                if (node.Value.ContainsKey("preID"))
                    temp.preID = Convert.ToInt32(node.Value["preID"]);
                else
                    temp.preID = 0;

                if (node.Value.ContainsKey("isEnable"))
                    temp.isEnable = Convert.ToInt32(node.Value["isEnable"]);
                else
                    temp.isEnable = 0;

                if (node.Value.ContainsKey("type"))
                    temp.isNormalType = Convert.ToInt32(node.Value["type"]);
                else
                    temp.isNormalType = 0;

                if (node.Value.ContainsKey("isPointer"))
                    temp.isPointer = Convert.ToInt32(node.Value["isPointer"]);
                else
                    temp.isPointer = 0;

                if (node.Value.ContainsKey("range"))
                    temp.range = Convert.ToSingle(node.Value["range"]);
                else
                    temp.range = 2;

                temp.pathPoint = Utils.ParseListAny<float>(node.Value["position"]);

                temp.pathPointRotation = Utils.ParseListAny<float>(node.Value["rotation"]);
                temp.pathPointSize = Utils.ParseListAny<float>(node.Value["size"]);

                if (node.Value.ContainsKey("movePosition"))
                {
                    temp.movePosition = Utils.ParseListAny<float>(node.Value["movePosition"]);
                }
                else
                {
                    temp.movePosition = new List<float>();
                    temp.movePosition.Add(0);
                    temp.movePosition.Add(0);
                    temp.movePosition.Add(0);
                }

                if (node.Value.ContainsKey("deleteList"))
                    temp.deleteList = Utils.ParseListAny<int>(node.Value["deleteList"]);
                else
                    temp.deleteList = new List<int>();

                //LoggerHelper.Error("   " + temp.pathPoint[0] + "   " + temp.pathPoint[1] + "  " + temp.pathPoint[2]);
                dataMap.Add(node.Key, temp);

                missionPathPointUnsorted.Add(temp);
                missionPathPoint[node.Key - 1] = temp;
            }

            missionPathPointUnsorted.Sort(delegate(MissionPathPointData p1, MissionPathPointData p2)
            {
                if (p1.id < p2.id)
                    return 1;
                else
                    return -1;
            });

            return true;
        }
        return false;
    }
    public static void CreateMissionPathPointObject(int id, MissionPathPointData data)
    {
        GameObject go = new GameObject();
        // go.name = "MissionPathPoint_" + id;

        go.transform.position = new Vector3(data.pathPoint[0], data.pathPoint[1], data.pathPoint[2]);
        go.transform.Rotate(data.pathPointRotation[0], data.pathPointRotation[1], data.pathPointRotation[2]);

        var collider = go.AddComponent<BoxCollider>();
        collider.size = new Vector3(data.pathPointSize[0], data.pathPointSize[1], data.pathPointSize[2]);
        collider.isTrigger = true;

        var script = go.AddComponent<MissionPathPointTriggerGear>();
        script.id = id;

        dataGameObjects.Add(id, go);
    }
Example #4
0
    public static bool ReloadData(int missionID)
    {
        var xml = XMLParser.Load(string.Concat(SystemConfig.CONFIG_SUB_FOLDER, IMPORT_FILE_PATH, missionID, IMPORT_FILE_EXTENSION, SystemConfig.CONFIG_FILE_EXTENSION));

        if (xml != null)
        {
            var map = XMLParser.LoadIntMap(xml, missionID + IMPORT_FILE_EXTENSION);

            missionPathPoint = new MissionPathPointData[map.Count];

            List <MissionPathPointData> missionPathPointUnsorted = new List <MissionPathPointData>();

            foreach (var node in map)
            {
                MissionPathPointData temp = new MissionPathPointData();

                temp.id = Convert.ToInt32(node.Key);

                if (node.Value.ContainsKey("preID"))
                {
                    temp.preID = Convert.ToInt32(node.Value["preID"]);
                }
                else
                {
                    temp.preID = 0;
                }

                if (node.Value.ContainsKey("isEnable"))
                {
                    temp.isEnable = Convert.ToInt32(node.Value["isEnable"]);
                }
                else
                {
                    temp.isEnable = 0;
                }

                if (node.Value.ContainsKey("type"))
                {
                    temp.isNormalType = Convert.ToInt32(node.Value["type"]);
                }
                else
                {
                    temp.isNormalType = 0;
                }

                if (node.Value.ContainsKey("isPointer"))
                {
                    temp.isPointer = Convert.ToInt32(node.Value["isPointer"]);
                }
                else
                {
                    temp.isPointer = 0;
                }

                if (node.Value.ContainsKey("range"))
                {
                    temp.range = Convert.ToSingle(node.Value["range"]);
                }
                else
                {
                    temp.range = 2;
                }

                temp.pathPoint = Utils.ParseListAny <float>(node.Value["position"]);

                temp.pathPointRotation = Utils.ParseListAny <float>(node.Value["rotation"]);
                temp.pathPointSize     = Utils.ParseListAny <float>(node.Value["size"]);

                if (node.Value.ContainsKey("movePosition"))
                {
                    temp.movePosition = Utils.ParseListAny <float>(node.Value["movePosition"]);
                }
                else
                {
                    temp.movePosition = new List <float>();
                    temp.movePosition.Add(0);
                    temp.movePosition.Add(0);
                    temp.movePosition.Add(0);
                }

                if (node.Value.ContainsKey("deleteList"))
                {
                    temp.deleteList = Utils.ParseListAny <int>(node.Value["deleteList"]);
                }
                else
                {
                    temp.deleteList = new List <int>();
                }

                //Debug.LogError("   " + temp.pathPoint[0] + "   " + temp.pathPoint[1] + "  " + temp.pathPoint[2]);
                dataMap.Add(node.Key, temp);

                missionPathPointUnsorted.Add(temp);
                missionPathPoint[node.Key - 1] = temp;
            }

            missionPathPointUnsorted.Sort(delegate(MissionPathPointData p1, MissionPathPointData p2)
            {
                if (p1.id < p2.id)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            });

            return(true);
        }
        return(false);
    }
Example #5
0
        private void PathPointTrigger(int triggerKey)
        {
            //检测是否此点已关闭,类型不是传送门

            //Mogo.Util.LoggerHelper.Debug("PathPointTrigger 0:" + (MissionPathPointData.missionPathPoint[triggerKey - 1].isEnable == 1) +
            //    (MissionPathPointData.missionPathPoint[triggerKey - 1].isNormalType == 1));
            if ((MissionPathPointData.missionPathPoint[triggerKey - 1].isEnable == 1) ||
                (MissionPathPointData.missionPathPoint[triggerKey - 1].isNormalType == 1))
            {
                return;
            }
            //Mogo.Util.LoggerHelper.Debug("PathPointTrigger 0:" + triggerKey + " " + (MissionPathPointData.missionPathPoint[triggerKey - 1].isEnable == 1) +
            //    (MissionPathPointData.missionPathPoint[triggerKey - 1].isNormalType == 1));
            //更新副本进度到服务器
            if (m_iFBProgress != triggerKey)
            {
                m_iFBProgress = (byte)triggerKey;
            }

            //开放此路点的关联路点
            List <int> tmpdeleteList = MissionPathPointData.missionPathPoint[triggerKey - 1].deleteList;

            if (tmpdeleteList.Count > 0)
            {
                for (int i = 0; i < tmpdeleteList.Count; i++)
                {
                    if (MissionPathPointData.missionPathPoint[tmpdeleteList[i] - 1].isEnable != 0)
                    {
                        MissionPathPointData.SetType(tmpdeleteList[i] - 1, 0);
                    }
                }
            }

            //此点设置为关闭
            //Mogo.Util.LoggerHelper.Debug("PathPointTrigger 2.1" + m_iGuideProgress + triggerKey);
            MissionPathPointData.SetType(triggerKey - 1, 1);
            //ProgressPointIndex = triggerKey;//10105bug
            //如果这个点是传送点并且是当前m_iGuideProgress,那么要指向下一个
            int totleCorners = MissionPathPointData.missionPathPoint.Length;

            if (m_iGuideProgress == triggerKey && m_iGuideProgress <= totleCorners)
            {
                //Mogo.Util.LoggerHelper.Debug("333:" + triggerKey + " " + m_iGuideProgress + " " + totleCorners);
                if (m_iGuideProgress == totleCorners)
                { //踩到是最后一个corner,让指针消失,一般最后一个点都不会是传送门,所以最后点只写在这里了
                    MogoWorld.touchLastPathPoint = true;
                    //检测指引消失/出现
                    EventDispatcher.TriggerEvent(Events.DirecterEvent.DirActive);
                }

                else
                {
                    for (int key = (MogoWorld.thePlayer.m_iGuideProgress + 1); key <= totleCorners; key++)
                    {
                        if (MissionPathPointData.missionPathPoint[key - 1].isPointer == 1)
                        {
                            MogoWorld.thePlayer.m_iGuideProgress = key;
                            break;
                        }
                    }
                    if (MogoWorld.thePlayer.m_iGuideProgress != 0)
                    {
                        MogoFXManager.Instance.UpdatePointerToTarget(new Vector3(
                                                                         MissionPathPointData.missionPathPoint[MogoWorld.thePlayer.m_iGuideProgress - 1].pathPoint[0],
                                                                         MogoWorld.thePlayer.Transform.position.y,
                                                                         MissionPathPointData.missionPathPoint[MogoWorld.thePlayer.m_iGuideProgress - 1].pathPoint[2]));
                        //检测指引消失/出现
                        EventDispatcher.TriggerEvent(Events.DirecterEvent.DirActive);
                    }
                    else
                    {
                        //找不到下一个pointer
                    }
                }
            }

            if (AutoFight == AutoFightState.RUNNING)
            {
                if (MissionPathPointData.missionPathPoint[triggerKey - 1].isNormalType == 2)
                {
                    //LoggerHelper.Error("22222222222222222222222222222222222222222222");
                    //踩在电梯点,走到电梯延伸点


                    Move();
                    (motor as MogoMotorMyself).MoveToWithoutNav(new Vector3(
                                                                    MissionPathPointData.missionPathPoint[triggerKey - 1].movePosition[0],
                                                                    MissionPathPointData.missionPathPoint[triggerKey - 1].movePosition[1],
                                                                    MissionPathPointData.missionPathPoint[triggerKey - 1].movePosition[2]
                                                                    ));
                    LockMove = true;

                    //DummyThink();
                }
            }
        }