public void SetPercent(float value) { for (int i = 0; i < effectNum; i++) { ActorParabolaUnit ap = apList[i]; ap.SetPercent(value); } }
public void Destroy() { for (int i = 0; i < effectNum; i++) { ActorParabolaUnit ap = apList[i]; ap.Destroy(); apList[i] = null; } apList = null; }
public ActorParabolaEffectUnit(GameObject _effectGO, Vector3 _startPos, Vector3 _endPos, int _effectNum, float time, Action <ActorParabolaEffectUnit, int, int> _callBack, int _targetIndex, int _bulletIndex) { effectNum = _effectNum; endPos = _endPos; effectGO = _effectGO; callBack = _callBack; targetIndex = _targetIndex; bulletIndex = _bulletIndex; apList = new ActorParabolaUnit[effectNum]; int index = (effectNum % 2 == 1) ? 0 : 1; for (int i = 0; i < effectNum; i++) { GameObject ins; if (i == 0) { ins = effectGO; } else { ins = GameObject.Instantiate(effectGO); } Vector3 interval = intervalList[index + i]; ActorParabolaUnit ap = new ActorParabolaUnit(ins, _startPos, endPos, interval); apList[i] = ap; } Action toCall = delegate() { callBack(this, targetIndex, bulletIndex); }; Action <float> SetPercent = delegate(float value) { for (int i = 0; i < effectNum; i++) { ActorParabolaUnit ap = apList[i]; ap.SetPercent(value); } }; int id = SuperTween.Instance.To(0, 1, time, SetPercent, toCall); SuperTween.Instance.SetTag(id, "battle_tag"); }
// private int toID; public ActorParabolaEffectUnit(GameObject _effectGO, Vector3 _startPos, Vector3 _endPos, int _effectNum, float time, Action <ActorParabolaEffectUnit, int, int> callBack, int _targetIndex, int _bulletIndex) { effectNum = _effectNum; endPos = _endPos; effectGO = _effectGO; apList = new ActorParabolaUnit[effectNum]; int index = (effectNum % 2 == 1) ? 0 : 1; for (int i = 0; i < effectNum; i++) { GameObject ins; if (i == 0) { ins = effectGO; } else { ins = GameObject.Instantiate(effectGO); } Vector3 interval = intervalList[index + i]; ActorParabolaUnit ap = new ActorParabolaUnit(ins, _startPos, endPos, interval); apList[i] = ap; } Action toCall = delegate() { // SuperTween.Instance.Remove(toID); callBack(this, _targetIndex, _bulletIndex); }; SuperTween.Instance.To(0, 1, time, SetPercent, toCall); }