示例#1
0
        public void Init(EntityMovable ownerEntity, List <Vector3> pathPosList, float speed, float normalizedTime = 0)
        {
            if (this.IsRunning())
            {
                string e = string.Format("{0}, {1}, {2} PathWander非法初始化", ownerEntity.entityID, ownerEntity.mainGameObject.name,
                                         ownerEntity.mainGameObject.GetInstanceID());
                throw new System.Exception(e);
            }

            if (pathPosList == null)
            {
                LogWarp.LogWarningFormat("[PathWander] 无法找到动物漫步路径, AnimalId={0}", ownerEntity.entityID);
            }
            this.pathData = new PathData()
            {
                vertices = pathPosList
            };
            InitPath(ref pathData);
            this.ownerEntity     = ownerEntity;
            this.speed           = speed;
            this.normalizedSpeed = pathData.lenTotal > 0 ? speed / pathData.lenTotal : 0.1f;
        }