//下一个buff private bool NextBuff() { if (_buffQueue.Count > 0) { var buff = _buffQueue.Dequeue(); _curBuff = buff; Vector3 nextMove = buff.MovePercent * _maxMoveDis; var fromPos = _transform.localPosition; var toPos = fromPos; toPos.x += nextMove.x; toPos = toPos.x <= _endPos.x ? toPos : _endPos; buff.SetHolder(_transform.gameObject, _moveController); buff.ChangeSpeed(_curSpeed); buff.Start(fromPos, toPos); return(false); } return(true); }
//解析一组赛跑队列 public void PrepareBuffData(ArrayList al, bool isWin) { for (int i = 0; i < al.Count; i++) { var unitData = al[i] as Hashtable; int order = System.Convert.ToInt16(unitData["index"]); int type = System.Convert.ToInt16(unitData["id"]); float speed = float.Parse(unitData["speed"].ToString()); _buffQueue.Enqueue(BaseActivityRacingBuff.CreateBuff(this, order, type, speed)); } if (isWin) { _buffQueue.Enqueue(BaseActivityRacingBuff.CreateBuff(this, al.Count, (int)BaseActivityRacingBuff.BuffTYPE.tLocalVictory, 0)); } else { _buffQueue.Enqueue(BaseActivityRacingBuff.CreateBuff(this, al.Count, (int)BaseActivityRacingBuff.BuffTYPE.tLocalLose, 0)); } }
public void Destroy() { _curBuff?.Destroy(); _curBuff = null; GameObject.Destroy(_transform.gameObject); _transform = null; }