//@ Set Activity
    public int setActivitySpline(int iSeqSpline, bool bDrawLine)
    {
        if (iSeqSpline < 0 || m_listProcessorSpline.Count < 1)
        {
            return(-1);
        }

        if (iSeqSpline >= m_listProcessorSpline.Count)
        {
            Debug.Log("Out of range Spline Select.  m_listProcessorSpline.Count="
                      + m_listProcessorSpline.Count + "//"
                      + "iSeqSpline=" + iSeqSpline + "////" + UnityEngine.Random.Range(0.0f, 10000.0f));

            return(-1);
        }

        Set_Inactivate_Current(_splineGenerator_active);

        m_iCurveActivate = iSeqSpline;

        if (true == bDrawLine)
        {
            _splineGenerator_active = m_listProcessorSpline[m_iCurveActivate];

            Set_activate_Current(_splineGenerator_active);
        }

        return(m_iCurveActivate);
    } // public int setActivitySpline(int iLayerCurve)
    //@ Unselect LineCurvePnts
    void Set_Inactivate_Current(CSplineGenerator processorSpline_activate)
    {
        if (null == processorSpline_activate)
        {
            return;
        }

        SetUnselectAll_CurvePathUnits();

        _Clear_LineDraw_Pnts();
        processorSpline_activate.SetUnselectAllCurvePath();
        processorSpline_activate.SetVisibleAllCurvePath(false);
    }
    } // public void LoadCurvePath_CMapTemplate()

    //@ Insert / Delete
    //@ Set New Layer Processor Spline
    public int setNewProcessorSpline()
    {
        Set_Inactivate_Current(_splineGenerator_active);

        CSplineGenerator processorSplineNew = new CSplineGenerator();

        m_listProcessorSpline.Add(processorSplineNew);
        int iSequenceSpline = m_listProcessorSpline.Count - 1;

        processorSplineNew.InitializeSplineGenerator(iSequenceSpline);

        m_iCurveActivate        = iSequenceSpline;
        _splineGenerator_active = processorSplineNew;

        return(m_iCurveActivate);
    }
    void Set_activate_Current(CSplineGenerator processorSpline_activate)
    {
        if (null == processorSpline_activate)
        {
            return;
        }

        foreach (CSplineGenerator processorSpline in m_listProcessorSpline)
        {
            processorSpline.SetVisibleAllCurvePath(false);
        }

        SetUnselectAll_CurvePathUnits();

        processorSpline_activate.SetVisibleAllCurvePath(true);
        processorSpline_activate.SetSelectAllCurvePath();

        //processorSpline_activate.BuildupCurve_spline(E_TYPE_SPLINE.SPLINE_NULL, -1);
        _Draw_LineCurvePnts(processorSpline_activate);
    }
    void ReleaseCurve_(CSplineGenerator processorSplinecurve_)
    {
        if (null == processorSplinecurve_)
        {
            return;
        }

        Set_Inactivate_Current(processorSplinecurve_);

        foreach (CCurvePathUnit curvePath in processorSplinecurve_.m_listCurvepathunit)
        {
            DeleteCurvePathUnit(curvePath);
        }

        if (null != processorSplinecurve_)
        {
            processorSplinecurve_.ClearCurveLine_spline();
            processorSplinecurve_.Release_ProcessorSpline();
        }

        processorSplinecurve_ = null;
    } // public void ReleaseCurve_()
    public void _Draw_LineCurvePnts(CSplineGenerator processSpline_)
    {
        if (null == processSpline_ || false == processSpline_.IsBuildedCurve() || null == m_arrColorLineDraw)
        {
            return;
        }

        Vector3[]  arrPntCurveLine = processSpline_.getSectionSpline();
        Vector3    v3PntCurve;
        Quaternion qtRot = new Quaternion();

        qtRot.eulerAngles = Vector3.forward;

        Color colorLayerCurveLine = m_arrColorLineDraw[processSpline_.getSeqProcessorSpline() % 9];

        for (int iSeqPnt = 0; iSeqPnt < arrPntCurveLine.Length; ++iSeqPnt)
        {
            v3PntCurve = arrPntCurveLine[iSeqPnt];
            CCurvePathLineDraw flylineDraw = (CCurvePathLineDraw)GameObject.Instantiate(processCycle.GetInstance.m_curvePathLineDraw_src, v3PntCurve, qtRot);
            flylineDraw.SetDiffuseColor(colorLayerCurveLine);

            m_listLineDraw.Add(flylineDraw);
        }
    }
    public bool LoadStage()
    {
        if (null == m_Filename)
        {
            return(false);
        }
        Release();

        string filepath = m_Forder + m_Filename + m_Ext;

        CFileManager tFile = CFileManager.GetInstance;

        //  load stream
        Stream ms = tFile.LoadFile(filepath);

        if (null == ms)
        {
            return(false);
        }

        BinaryReader br = new BinaryReader(ms);

        //  MapTri
        int count  = 0;
        int count2 = 0;

        count = br.ReadInt32();
        CTRI tri = null;

        for (int i = 0; i < count; i++)
        {
            tri = new CTRI();
            for (int j = 0; j < 3; j++)
            {
                tri._arrv3PT[j].x = br.ReadSingle();
                tri._arrv3PT[j].y = br.ReadSingle();
                tri._arrv3PT[j].z = br.ReadSingle();
                tri._arriIV[j]    = br.ReadInt32();
            }

            tri._v3TriNormal.x    = br.ReadSingle();
            tri._v3TriNormal.y    = br.ReadSingle();
            tri._v3TriNormal.z    = br.ReadSingle();
            tri._arrEdgeLength[0] = br.ReadSingle();
            tri._arrEdgeLength[1] = br.ReadSingle();
            tri._arrEdgeLength[2] = br.ReadSingle();

            AddTriangle(tri);
        }
        //  MapArrageBase
        count = br.ReadInt32();
        CBASE__ towerArrange = null;

        for (int i = 0; i < count; i++)
        {
            towerArrange = new CBASE__();
            count2       = br.ReadInt32();
            for (int j = 0; j < count2; j++)
            {
                towerArrange._listIdxTris.Add(br.ReadInt32());
            }

            count2 = br.ReadInt32();
            for (int j = 0; j < count2; j++)
            {
                Vector3 vec = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
                towerArrange._listv3Pnts.Add(vec);
            }
            //  중앙포지션
            towerArrange._v3PositionCenter.x = br.ReadSingle();
            towerArrange._v3PositionCenter.y = br.ReadSingle();
            towerArrange._v3PositionCenter.z = br.ReadSingle();

            //  삼각형 정보
            count2 = br.ReadInt32();
            for (int j = 0; j < count2; j++)
            {
                Vector3 vec = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
                towerArrange._listv3PntsSrc.Add(vec);
            }

            AddBaseTower(towerArrange);
            m_BaseTowerMeshIndex.Add(towerArrange._listIdxTris[0], i);
            m_BaseTowerMeshIndex.Add(towerArrange._listIdxTris[1], i);
        }
        //  MainCoreList
        count = br.ReadInt32();
        BaseInfo core;

        for (int i = 0; i < count; i++)
        {
            core = new BaseInfo();
            core.CoreLoad(br);
            AddMainCore(core);
        }
        //  SubCoreList
        count = br.ReadInt32();
        for (int i = 0; i < count; i++)
        {
            core = new BaseInfo();
            core.CoreLoad(br);
            AddSubCore(core);
        }
        //  StartBaseList
        count = br.ReadInt32();
        for (int i = 0; i < count; i++)
        {
            core = new BaseInfo();
            core.CoreLoad(br);
            AddStartBase(core);
        }
        //  BlockBaseList
        count = br.ReadInt32();
        for (int i = 0; i < count; i++)
        {
            core = new BaseInfo();
            core.CoreLoad(br);
            AddBlockBase(core);
        }
        //  GoalPoint
        count = br.ReadInt32();
        for (int i = 0; i < count; i++)
        {
            AddGoalPoint(br.ReadInt32());
        }
        //  GroundMonster_StartPoint
        count = br.ReadInt32();
        for (int i = 0; i < count; i++)
        {
            AddGroundStartPoint(br.ReadInt32());
        }
        //  BlockPoint
        count = br.ReadInt32();
        for (int i = 0; i < count; i++)
        {
            AddGroundBlockPoint(br.ReadInt32());
        }

        //  BlockRoadPoint
        count = br.ReadInt32();
        for (int i = 0; i < count; i++)
        {
            AddGroundBlockRoadPoint(br.ReadInt32());
        }

        //  flyPath list
        count = br.ReadInt32();
        CSplineGenerator path = null;

        for (int i = 0; i < count; i++)
        {
            path = new CSplineGenerator();

            path.SetTypeSplineCurve((E_TYPE_SPLINE)br.ReadUInt32());
            path.SetDivisionWeight(br.ReadSingle());

            count2 = br.ReadInt32();
            for (int j = 0; j < count2; j++)
            {
                Vector3 vec = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
                path.SetNewCurvePoint_spline(vec);
            }

            AddFlyPath(path);
        }

        //  파일포인터 맨처음으로
        ms.Seek(0, SeekOrigin.Begin);

        return(true);
    }
 public void AddFlyPath(CSplineGenerator path)  //  Add fly path
 {
     m_FlyUnitPath_List.Add(path);
 }