示例#1
0
    //@ Delete Curve Current, not destroy instance.
    public bool DeleteCurvePath(CCurvePathUnit curvepathUnitDel)
    {
        if (m_listCurvepathunit.Count < 1)
        {
            return(false);
        }

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

        int iSeqPathDel = -1;

        for (int iSeqPath = 0; iSeqPath < m_listCurvepathunit.Count; ++iSeqPath)
        {
            CCurvePathUnit flypathunitCurr = m_listCurvepathunit[iSeqPath];
            if (curvepathUnitDel == flypathunitCurr)
            {
                iSeqPathDel = iSeqPath;
                break;
            }
        }

        if (-1 != iSeqPathDel)
        {
            m_listCurvepathunit.RemoveAt(iSeqPathDel);
            m_listPath_Spline.RemoveAt(iSeqPathDel);
        }

        return(true);
    } // public bool DeleteCurvePath(CCurvePathUnit curvepathUnitDel)
示例#2
0
 //@ Set select All CurvePath
 public void SetSelectAllCurvePath()
 {
     for (int iSeqUnit = 0; iSeqUnit < m_listCurvepathunit.Count; ++iSeqUnit)
     {
         CCurvePathUnit pathUnit = m_listCurvepathunit[iSeqUnit];
         pathUnit.setSelectFlyPathUnit(iSeqUnit);
     }
 }
    } // public void ClearCurveGuidelineAll()

    #endregion // staticparam_guideline_splinecurve

    public void LoadCurvePath_CMapTemplate(List <CSplineGenerator> flyPath)
    {
        int iSeqpath = 0;

        foreach (CSplineGenerator path in flyPath)
        {
            int   type             = (int)path.GetTypeSplineCurve();
            bool  bRequestFromTool = processCycle.GetInstance._modeTool;
            float divideWeight     = path.GetDivisionWeight();
            int   pathSize         = path.m_listPath_Spline.Count;


            if (path.m_listPath_Spline.Count < 1)
            {
                continue;
            }

            if (divideWeight < 0)
            {
                divideWeight = CSplineGenerator.DFLT_WEIGHT_TIMEDIVIDE;
            }

            setNewProcessorSpline();

            for (int i = 0; i < pathSize; ++i)
            {
                Vector3 pnt = new Vector3(path.m_listPath_Spline[i].x, path.m_listPath_Spline[i].y, path.m_listPath_Spline[i].z);

                //@ Add PathUnit
                if (true == bRequestFromTool)
                {
                    CCurvePathUnit flypathUnit = InsertNewCurvePathUnit_BLANK(pnt);

                    if (null != flypathUnit)
                    {
                        ActivateOrUnactivateCurvePoint(flypathUnit);
                    }
                    else
                    {
                        Debug.Log("(null==flypathUnit)//");
                    }
                }
                else
                {
                    ActivateCurvePosition(pnt);
                }
            }

            BuildupCurve(iSeqpath, (E_TYPE_SPLINE)type, divideWeight);

            iSeqpath++;
        } // foreach( CSplineGenerator path in flyPath)

        setActivitySpline(0, false);
    } // public void LoadCurvePath_CMapTemplate()
    public CCurvePathUnit InsertNewCurvePathUnit_BLANK(Vector3 v3PointCurvePathUnit)
    {
        CCurvePathUnit flypathUnit = (CCurvePathUnit)GameObject.Instantiate(processCycle.GetInstance.m_curvePathUnit_src, v3PointCurvePathUnit, Quaternion.identity);

        flypathUnit.InitializeFlyPathUnit();

        m_listCurvePathUnit.Add(flypathUnit);
        m_listCurvePathUnit.Sort(m_ICompCurvePath);

        return(flypathUnit);
    }
    //@ New CurvePoint
    public bool ActivateOrUnactivateCurvePoint(CCurvePathUnit flypathPoint)
    {
        if (null == _splineGenerator_active)
        {
            Debug.Log("Any spline curve does not selected." + "//" + UnityEngine.Random.Range(0.0f, 1000.0f));
            return(false);
        }

        _splineGenerator_active.RegisterOrUnregisterCurvePath_spline(flypathPoint);

        return(true);
    }
    void DeleteCurvePathUnit(CCurvePathUnit flypathunitDel)
    {
        if (null == flypathunitDel)
        {
            return;
        }

        m_listCurvePathUnit.Remove(flypathunitDel);

        flypathunitDel.setUnselectFlyPathUnit();
        flypathunitDel.Release_curvepathUnit();

        GameObject.Destroy(flypathunitDel.gameObject);

        return;
    }
    public void DeleteCurvePathUnitInclude(CCurvePathUnit flypathunitDel)
    {
        if (null == flypathunitDel)
        {
            return;
        }

        foreach (CSplineGenerator processorSplineCurve in m_listProcessorSpline)
        {
            if (null != processorSplineCurve)
            {
                processorSplineCurve.DeleteCurvePath(flypathunitDel);
            }
        }

        DeleteCurvePathUnit(flypathunitDel);
    }
示例#8
0
    //@ Process // Activate or Unactivate
    public void RegisterOrUnregisterCurvePath_spline(CCurvePathUnit flypathPoint)
    {
        if (null == flypathPoint)
        {
            return;
        }

        if (m_listCurvepathunit.Count > 0)
        {
            int iIdxFind = findCurvePoint(flypathPoint);

            if (-1 < iIdxFind)
            {
                flypathPoint.setUnselectFlyPathUnit();
                DeleteCurvePath(flypathPoint);
                return;
            }
            else
            {
                if (true == flypathPoint.getSelect())
                {
                    flypathPoint.setUnselectFlyPathUnit();
                }
                else
                {
                    int iSeqpath = m_listCurvepathunit.Count;
                    flypathPoint.setSelectFlyPathUnit(iSeqpath);
                }
            }
        }
        else
        {
            int iSeqpath = m_listCurvepathunit.Count;
            flypathPoint.setSelectFlyPathUnit(iSeqpath);
        }

        m_listCurvepathunit.Add(flypathPoint);
        m_listCurvepathunit.Sort(m_ICompCurvePath);

        SetNewCurvePoint_spline(flypathPoint.getPosUnit());

        return;
    } // public bool SetNewCurvePoint_spline(CCurvePathUnit flypathPoint)
    } // protected void loadingProcess_Binary

    //@ Initialize managements.
    public void Initialize(processResource resources)
    {
        if (null == resources)
        {
            Debug.Log("ERROR(critical) all gameobjectProcessResource is null.");
            return;
        }

        _modeTool = true;

        //@ re-link resource all.
        m_datanavimeshs         = resources._navimeshResource;
        m_unitFactory_          = resources._unitfactory;
        m_processInput          = resources._processInput;
        m_curvePathUnit_src     = resources._curvePathUnit_src;
        m_curvePathLineDraw_src = resources._curvePathLineDraw_src;
        m_drawText3D_src        = resources._drawText3D_src;
        m_unitFlying_src        = resources._unitFlying_src;
        m_unitWalking_src       = resources._unitWalking_src;
        m_selectBox_src         = resources._selectBox_src;
        m_combo_src             = resources._combo_src;

        _IdxKeyNavi = m_datanavimeshs.StartNaviMesh;

        m_speedmove_unitwalking = m_processInput.velocity_unitwalking;
        m_speedmove_unitflying  = m_processInput.velocity_unitflying;

        //@ Construct
        m_baseTowerCollector   = new CBaseTowerCollector();
        m_baseCoreCollector    = new CBaseCoreCollector();
        m_baseCoresubCollector = new CBaseCoreSubCollector();
        m_baseStartCollector   = new CBaseStartCollector();
        m_baseBlockCollector   = new CBaseBlockCollector();

        m_toolmoduleNavimesh  = new CToolModuleNavimesh();
        m_intervalUnitWalking = new IntervalUnitWalking();

        //@ Initialize
        m_processInput.InitProcessInput(this);
        m_toolmoduleNavimesh.InitNaviMeshTool();
        m_baseTowerCollector.InitBaseCollector();
        m_baseCoreCollector.InitBaseCollector();
        m_baseCoresubCollector.InitBaseCollector();
        m_baseStartCollector.InitBaseCollector();
        m_baseBlockCollector.InitBaseBlockCollector(m_processInput._blockbasetypes.Length);

        //@ Initialize all managers
        bool bResult = false;

        bResult = resetGlobal(_IdxKeyNavi, m_processInput._loadfrom_geometry);
        if (false == bResult)
        {
            Debug.Log("ERROR. resetGlobal().//");
        }

        //@ Application execute mode, which is naviscene or gamescene
        processCycle.APPLICATION_MODE_NAVITOOL = true;

        GameContext gamecontext = GameContext.GetInstance;

        gamecontext.ShowDebugInfo = false;
    } // void Initialize
示例#10
0
 protected int findCurvePoint(CCurvePathUnit flypathPoint)
 {
     return(m_listCurvepathunit.BinarySearch(flypathPoint, m_ICompCurvePath));
 }