コード例 #1
0
        public void getWayPtList(MList <MazePtBase> ptList_, int pathIdx)
        {
            MazePtBase         pt   = null;
            MList <MazePtBase> list = null;

            if ((int)eRoomIndex.eStart == m_fixIdx || (int)eRoomIndex.eEnd == m_fixIdx)
            {
                list = m_ptListArr[(int)ePathIndex.eABC];
            }
            else
            {
                list = m_ptListArr[pathIdx];
            }

            if (list != null)
            {
                for (int idx = 0; idx < list.Count(); ++idx)
                {
                    pt = list[idx].clone();
                    ptList_.Add(pt);

                    pt.pos = UtilApi.convPtFromLocal2Local(this.selfGo.transform, Ctx.m_instance.m_maze.mazeData.sceneRootGo.transform, list[idx].pos);

                    // 如果父节点没有缩放时是正确的,如果有缩放,就是错误的
                    //pt.pos = list[idx].pos + selfGo.transform.localPosition;
                }
            }
        }
コード例 #2
0
        protected void buildPathPt6f(int pathIdx)
        {
            MazePtBase pt   = null;
            string     path = "";

            for (int idx = 0; idx < 6; ++idx)
            {
                if (0 == idx)
                {
                    pt = new MazeStartPt();
                }
                else if (3 == idx)
                {
                    pt = new MazeEndPt();
                }
                else if (4 == idx)
                {
                    pt = new MazeBombPt();
                }
                else if (5 == idx)
                {
                    pt = new MazeDiePt();
                }
                else
                {
                    pt = new MazeComPt();
                }
                m_ptListArr[pathIdx].Add(pt);

                path   = string.Format("WayPt_{0}{1}", pathIdx, idx);
                pt.pos = UtilApi.TransFindChildByPObjAndPath(this.selfGo, path).transform.localPosition;
            }
        }
コード例 #3
0
        // 移动结束回调
        protected void onMoveEndHandle(NumAniSeqBase dispObj)
        {
            if (m_ptList.Count() > 0 && !m_bDiePt)  // 说明还有 WayPoint 可以走
            {
                MazePtBase pt = m_ptList[0];
                m_ptList.RemoveAt(0);
                pt.moveToDestPos(m_mazePlayer);
            }
            else    // 如果运行到终点位置
            {
                m_ptList.Clear();

                if (m_BDiedPlayEffect)
                {
                    playDieAniAndSound();
                }

                //bool bChangeScene = false;
                if (!m_bBombPt && !m_bDiePt)     // 如果胜利
                {
                    //Ctx.m_instance.m_maze.mazeData.mazeScene.show();
                    //bChangeScene = true;

                    if (Ctx.m_instance.m_maze.mazeData.curSceneIdx == (int)eSceneIndex.eSecond)
                    {
                        Ctx.m_instance.m_maze.mazeData.roomInfo.showLightWin();
                        Ctx.m_instance.m_maze.mazeData.mazePlayer.hide();
                    }
                    else
                    {
                        Ctx.m_instance.m_maze.mazeData.mazeScene.showStar();
                    }
                }
                m_bBombPt         = false;
                m_bDiePt          = false;
                m_BDiedPlayEffect = false;
                Ctx.m_instance.m_uiMgr.loadAndShow(UIFormID.eUIMaze);

                UIMaze uiMaze = Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIMaze) as UIMaze;
                if (uiMaze != null)
                {
                    uiMaze.toggleResetBtn(true);
                }

                string path = "";
                path = Path.Combine(Ctx.m_instance.m_cfg.m_pathLst[(int)ResPathType.ePathAudio], "Ground.mp3");
                Ctx.m_instance.m_soundMgr.stop(path);
                path = Path.Combine(Ctx.m_instance.m_cfg.m_pathLst[(int)ResPathType.ePathAudio], "GameOver.mp3");
                Ctx.m_instance.m_soundMgr.play(path, false);

                //if(bChangeScene)
                //{
                //    if (Ctx.m_instance.m_maze.mazeData.curSceneIdx == (int)eSceneIndex.eFirst)
                //    {
                //        Ctx.m_instance.m_maze.mazeData.mazeScene.loadSecondScene();
                //    }
                //}
            }
        }
コード例 #4
0
        protected MazePtBase createWayPtByGo(int pathIdx, int idx, string suffix)
        {
            MazePtBase pt   = null;
            string     path = "";
            GameObject go_  = null;

            path = string.Format("WayPt_{0}{1}{2}", pathIdx, idx, suffix);
            go_  = UtilApi.TransFindChildByPObjAndPath(this.selfGo, path);
            if (null != go_)
            {
                if ("_Start" == suffix)
                {
                    pt = new MazeStartPt();
                }
                else if ("_Start_Jump" == suffix)
                {
                    pt = new MazeStartJumpPt();
                }
                else if ("_Start_Show" == suffix)
                {
                    pt = new MazeStartShowPt();
                }
                else if ("_Start_Door" == suffix)
                {
                    pt = new MazeStartDoorPt();
                }
                else if ("_End" == suffix)
                {
                    pt = new MazeEndPt();
                }
                else if ("_End_Jump" == suffix)
                {
                    pt = new MazeEndJumpPt();
                }
                else if ("_End_Hide" == suffix)
                {
                    pt = new MazeEndHidePt();
                }
                else if ("_End_Door" == suffix)
                {
                    pt = new MazeEndDoorPt();
                }
                else if ("_End_Die" == suffix)
                {
                    pt = new MazeEndDiePt();
                }
                else
                {
                    pt = new MazeComPt();
                }

                pt.pos = go_.transform.localPosition;
            }

            return(pt);
        }
コード例 #5
0
        protected void moveToNextPos(MazePtBase pt_)
        {
            PosAni posAni;
            posAni = new PosAni();
            m_numAniParal.addOneNumAni(posAni);
            posAni.setGO(m_mazePlayer.selfGo);
            posAni.destPos = pt_.pos;
            posAni.setTime(sTime);
            posAni.setEaseType(iTween.EaseType.linear);

            m_numAniParal.play();
        }
コード例 #6
0
        protected void moveToNextPos(MazePtBase pt_)
        {
            PosAni posAni;

            posAni = new PosAni();
            m_numAniParal.addOneNumAni(posAni);
            posAni.setGO(m_mazePlayer.selfGo);
            posAni.destPos = pt_.pos;
            posAni.setTime(sTime);
            posAni.setEaseType(iTween.EaseType.linear);

            m_numAniParal.play();
        }
コード例 #7
0
        protected void buildPathSecond(int pathIdx)
        {
            MazePtBase    pt          = null;
            int           emptyCount  = 0;
            List <string> wayPtSuffix = new List <string>();

            wayPtSuffix.Add("");
            wayPtSuffix.Add("_Start");
            wayPtSuffix.Add("_Start_Jump");
            wayPtSuffix.Add("_Start_Show");
            wayPtSuffix.Add("_Start_Door");
            wayPtSuffix.Add("_End");
            wayPtSuffix.Add("_End_Jump");
            wayPtSuffix.Add("_End_Hide");
            wayPtSuffix.Add("_End_Door");
            wayPtSuffix.Add("_End_Die");

            // 最多 10 个点
            for (int idx = 0; idx < 10; ++idx)
            {
                emptyCount = 0;

                for (int suffixIdx = 0; suffixIdx < wayPtSuffix.Count; ++suffixIdx)
                {
                    pt = createWayPtByGo(pathIdx, idx, wayPtSuffix[suffixIdx]);
                    if (null == pt)
                    {
                        ++emptyCount;
                    }
                    else
                    {
                        m_ptListArr[pathIdx].Add(pt);
                        break;
                    }
                }

                if (emptyCount == wayPtSuffix.Count)
                {
                    break;
                }
            }
        }
コード例 #8
0
ファイル: MazePtBase.cs プロジェクト: zhutaorun/unitygame
 virtual public void copyFrom(MazePtBase rh)
 {
     this.m_ptType = rh.m_ptType;
     this.m_pos = rh.m_pos;
 }
コード例 #9
0
 virtual public void copyFrom(MazePtBase rh)
 {
     this.m_ptType = rh.m_ptType;
     this.m_pos    = rh.m_pos;
 }