public void RecoveryNode(ref List <CacheData> list) { for (int i = list.Count - 1; i >= 0; --i) { IPTTile node = list[i].node; list.RemoveAt(i); RecoveryNode(node); } list.Clear(); }
public float ApplyforResource(IPTTile node) { float progress = getTileStartProgress(node); // 计算滑块的长度占据的部分数值 float len = 0; float ratio = len / this._trackViewer.GetTrackLength(); this.occupiedProgress = progress + ratio; return(this.occupiedProgress); }
private void PushIntoTackline(int lineIndex, IPTTile node) { CurveTrackLine line = _lineList[lineIndex]; if (line == null) { Debug.LogError("not contain this line index " + lineIndex); } intoTrackNodeCount++; line.PushValue(node, intoTrackNodeCount); }
private void UpdateTilePosition(IPTTile node) { //node.progress = node.progress - (Time.deltaTime * Game.instance.tileSpeed); Vector3 position = this._trackViewer._spline.GetPositionOnSpline(node.getProcess()); Quaternion rotation = this._trackViewer._spline.GetOrientationOnSpline(node.getProcess()); //position.x += OffsetX; position += (rotation * new Vector3(OffsetX, OffsetY, 0)); node.setPosition(position); node.setRotation(rotation); node.onUpdate(); }
public override bool CheckPushValue(IPTTile value, int lineIndex = -1) { if (lineIndex < 0) { return(_prepareList.Count < m_maxCacheNum); } CurveTrackLine trackline = _lineList[lineIndex]; if (trackline == null) { return(false); } return(trackline.CheckPushValue(value)); }
public override bool PushValue(IPTTile node, int lineIndex) { CurveTrackLine line = _lineList[lineIndex]; if (line != null) { line.ApplyforResource(node); } CacheData data = new CacheData(); data.lineIndex = lineIndex; data.node = node; _prepareList.Add(data); return(true); }
public override void PushValue(IPTTile node, int latestCount) { base.PushValue(node, latestCount); // 倒叙 _operateList.Insert(0, node); //float progress = this._trackViewer.progress + node.getPositionProgress(); float progress = getTileStartProgress(node); Vector3 position = this._trackViewer._spline.GetPositionOnSpline(progress); Quaternion rotation = this._trackViewer._spline.GetOrientationOnSpline(progress); node.setProcess(progress); //position.x += OffsetX; position += (rotation * new Vector3(OffsetX, OffsetY, 0)); node.setPosition(position); node.setRotation(rotation); node.Appear(lineIndex); }
public override void OnUpdate() { int count = _operateList.Count; for (int i = count - 1; i >= 0; --i) { IPTTile node = _operateList[i]; UpdateTilePosition(node); //if (node.getStartProcess() + TrackNumDef.tileLifeProgress <= this._trackViewer.progress) //{ // _operateList.RemoveAt(i); // this._trackViewer.RecoveryNode(node); //} if (node.getEndProcess() <= this._trackViewer.progress) { _operateList.RemoveAt(i); this._trackViewer.RecoveryNode(node); } } }
// 压入节点数据 //public bool PushValue(NodeObject node) public bool PushValue(IPTTile node, int lineIndex = -1) { if (lineIndex < 0) { // 采用默认的随机分配 int lineNum = this.trackViewer.GetTracklineNum(); int randValue = UnityEngine.Random.Range((int)0, (int)(lineNum * 100)); if (randValue * 0.01f > (lineNum * 0.5f)) { lineIndex = m_lastTrackIndex + 1; } else { lineIndex = m_lastTrackIndex - 1; } lineIndex = (lineIndex < 0) ? 0 : ((lineIndex >= lineNum) ? lineNum - 1 : lineIndex); if (!this.trackViewer.CheckPushValue(node, lineIndex)) { for (int i = 1; i < lineNum; ++i) { int newIndex = (lineIndex + i) % lineNum; if (this.trackViewer.CheckPushValue(node, newIndex)) { lineIndex = newIndex; break; } } } } m_lastTrackIndex = lineIndex; return(this.trackViewer.PushValue(node, lineIndex)); }
public bool CheckPushValue(IPTTile tile, int lineIndex) { return(this.trackViewer.CheckPushValue(tile, lineIndex)); }
public override bool CheckPushValue(IPTTile node) { float progress = getTileStartProgress(node); return(progress >= this.occupiedProgress); }
public virtual bool CheckPushValue(IPTTile value) { return(true); }
private float getTileStartProgress(IPTTile node) { return(this._trackViewer.progress + node.getPositionProgress()); }
public virtual void PushValue(IPTTile node, int latestCount) { _tileList.Add(node); }
public void RecoveryNode(IPTTile node) { node.Disappear(); //NodeManager.instance.RecoverNode(node); //Debug.LogWarning("未实现节点回收"); }
public virtual bool PushValue(IPTTile value, int lineIndex) { return(true); }
public virtual bool CheckPushValue(IPTTile value, int lineIndex = -1) { return(true); }