public virtual void Init(EntityMovable ownerEntity, int groupID, int idx, List <Vector3> pathPosList, Vector3 orgPos, int nextPosIdx, float speed) { if (this.IsRunning()) { string e = string.Format("{0} {1} FollowPathRightAngles非法初始化", ownerEntity.entityID, ownerEntity.mainGameObject.GetInstanceID()); throw new System.Exception(e); } this.ownerEntity = ownerEntity; this.pathPosList = pathPosList; this.orgPos = orgPos; this.nextPosIdx = nextPosIdx; this.nextPos = this.pathPosList[this.nextPosIdx]; this.speed = speed * 0.001f; this.orgRotation = this.ownerEntity.mainGameObject.transform.rotation; this.isArrivedEnd = false; idxCtr = 0; //停止旋转CD turnCD.Stop(); this.turnSpeed = CalcTurnSpeed(this.speed); //因为知道角度是90度所以cd是旋转cd恒定的 turnCDVal = Math_F.FloatToInt(cornerAngle / this.turnSpeed); var pathUnit = GroundParingSpacePathManager.GetInstance().GetPathUnit(groupID, idx); if (!GroundParingSpacePathManager.IsExist(pathUnit.inPathRac)) { ctrList = GroundParingSpacePathManager.GenRAC(pathPosList, this.turnOffset); GroundParingSpacePathManager.GetInstance().AddPath( GroundParingSpacePathType.InPathRac, pathUnit, null, ctrList); } ctrList = pathUnit.inPathRac; this.groupID = groupID; this.idx = idx; isForward = true; //先把朝向转到第一个后点 ownerEntity.LookAt(ctrList[0].backPos); }
public virtual void Init(EntityMovable ownerEntity, string pathName, List <Vector3> pathPosList, Vector3 orgPos, int nextPosIdx, float speed) { if (this.IsRunning()) { string e = string.Format("{0} {1} FollowPathRightAngles非法初始化", ownerEntity.entityID, ownerEntity.mainGameObject.GetInstanceID()); throw new System.Exception(e); } this.ownerEntity = ownerEntity; this.pathPosList = pathPosList; this.pathName = pathName; this.orgPos = orgPos; this.nextPosIdx = nextPosIdx; this.nextPos = this.pathPosList[this.nextPosIdx]; this.speed = speed * 0.001f; this.orgRotation = this.ownerEntity.mainGameObject.transform.rotation; this.isArrivedEnd = false; idxCtr = 0; //停止旋转CD turnCD.Stop(); this.turnSpeed = CalcTurnSpeed(this.speed); //因为知道角度是90度所以cd是旋转cd恒定的 turnCDVal = Math_F.FloatToInt(cornerAngle / this.turnSpeed); ctrList = CalcPathManager.GetInstance().GetRac(pathName); if (ctrList == null) { ctrList = GenControllNodeList(pathPosList, this.turnOffset); CalcPathManager.GetInstance().AddRac(pathName, ctrList); } isForward = true; //先把朝向转到第一个后点 ownerEntity.LookAt(ctrList[0].backPos); }