Esempio n. 1
0
        public static C_PathWaypoint CreateOne(GameObject target, C_Path path, bool isPausePoint = true)
        {
            Debug.Log("生成漫游点");
            GameObject go = GameObject.CreatePrimitive(PrimitiveType.Sphere);

            go.transform.SetParent(path.transform);
            go.transform.position = target.transform.position;
            go.transform.rotation = Quaternion.identity;
            go.name = target.name + " path";
            C_PathWaypoint p = go.AddComponent <C_PathWaypoint>();

            p.path     = path;
            p.needStop = isPausePoint;
            return(p);
        }
        /// 通过儿子的名称
        public void StartPath(string songName)
        {
            //原工程
            //WVR_Methord.CloseConsPointer_R();
            stopStepIndex = 0;
            Transform son = transform.Find(songName);

            if (son == null)
            {
                return;
            }
            C_Path path = son.GetComponent <C_Path>();

            if (path == null)
            {
                return;
            }
            StartPath(path);
        }
        /// 重头开始一条路径
        public void StartPath(C_Path cPath)
        {
            Vector3[] posS = cPath.GetPath();
            curPath = cPath;
            float duration  = cPath.duration;
            bool  close     = cPath.closePath;
            float delay     = cPath.delay;
            int   loop      = cPath.loop;
            float lookAhead = cPath.lookAhead;

            curPath = cPath;
            //先按路径点算着,相信dotween的优化
            SetPath(posS, duration, close, delay, loop, lookAhead);
            //SetPath根据位置点灵活的选择看向(posS, duration, close);
            //if (cPath.lookFor == null)
            //{
            //SetPath(posS, duration, close, delay, loop, lookAhead);
            //}
            //else
            //{
            //    SetPath(posS, duration, close, cPath.lookFor, delay, loop);
            //}
        }