示例#1
0
    private void GetWayPointData()
    {
        int wpIndex = mCurrentWayPoint;

        //mWayPointList = mModuleData.WayPointList;

        _startPosition = mWayPointList.GetVector3AtIndex(wpIndex);

        _startPosition += WayPointOffset;

        if (wpIndex < mMaxWayPointCount - 1)
        {
            _destinationPosition  = mWayPointList.GetVector3AtIndex(wpIndex + 1);
            _destinationPosition += WayPointOffset;
        }
        else
        {
            //arrived at end point
            mOnEndPoint = true;
        }

        WayPoint wp = mWayPointList.GetWayPointDataAtIndex(wpIndex);

        _waitTime = wp.WaitTime;

        //_velocity = wp.Velocity;
        _velocity = 1f;

        _acceleration        = wp.Acceleration;
        _decelAtPercentOfMag = wp.DecelAtPercentOfMag;
        _decelaration        = wp.Decelaration;
        _minVelocity         = wp.MinVelocity;
        _chanceToReverse     = wp.ChanceToReverse;
        _chanceToSkip        = wp.ChanceToSkip;

        _elaspedWaitTime = 0f;

        mCurrentWayPoint++;

        _State = eState.CalculatePath;
    }
示例#2
0
    private static void EditSelectedWayPoint()
    {
        GameObject selectedGameObject = Selection.activeGameObject;

        Debug.Log("selectedGameObject = " + selectedGameObject.name);

        //this is the WayPointList
        WayPointList wpList = selectedGameObject.GetComponent <WayPointList> ();


        //this is the WayPointManager
        GameObject      WayPointManagerObject = GameObject.Find("WayPointManager");
        WayPointManager wpManager             = WayPointManagerObject.GetComponent <WayPointManager> ();
        string          pName     = wpManager.PrefabName;
        int             numPoints = wpList.NumPointsUsed;
        bool            HasData   = wpList.HasData;

        wpManager.PrefabName    = wpList.PrefabName;
        wpManager.NumPointsUsed = wpList.NumPointsUsed;
        wpManager.HasData       = wpList.HasData;

        Debug.Log("EditSelectedWayPoint : numPoints = " + numPoints);
        for (int i = 0; i < numPoints; i++)
        {
            Vector3 vec = wpList.GetVector3AtIndex(i);
            WayPointManager.Instance.mWayPointEditList [i].transform.position = new Vector3(vec.x, vec.y, vec.z);

            if (HasData == true)
            {
                WayPoint wp = wpList.GetWayPointDataAtIndex(i);
                WayPointManager.Instance.mWayPointEditStructs [i] = wp;
            }
        }

        Debug.Log("wpManager pName = " + pName);
    }