static public DelayTime Create(float duration_) { DelayTime action = new DelayTime(); action.InitWithDuration(duration_); return(action); }
public void InitWithActions(params ActionBase[] actions_) { int size = actions_.Length; if (size == 0) { InitWithDuration(0); return; } if (size == 1) { InitWithTwoActions(actions_[0], DelayTime.Create(0)); return; } ActionBase prev = actions_[0]; //从第二个开始 for (int i = 1, len = actions_.Length - 1; i < len; ++i) { prev = CreateWithTwoActions(prev, actions_[i]); } InitWithTwoActions(prev, actions_.Last()); }
public void InitWithTwoActions(ActionBase a1_, ActionBase a2_) { if (a2_ == null) { a2_ = DelayTime.Create(0); } float d1 = a1_.Duration; float d2 = a2_.Duration; float maxTime = Mathf.Max(d1, d2); InitWithDuration(maxTime); if (d1 > d2) { m_action1 = a1_; m_action2 = Sequence.CreateWithTwoActions(a2_, DelayTime.Create(d1 - d2)); } else { m_action1 = Sequence.CreateWithTwoActions(a1_, DelayTime.Create(d2 - d1)); m_action2 = a2_; } }
public void InitWithTwoActions(ActionBase a1_, ActionBase a2_) { m_action1 = a1_; if (a2_ != null) { m_action2 = a2_; } else { m_action2 = DelayTime.Create(0f); } float duration = m_action1.Duration + m_action2.Duration; //duration不能都为0 //duration = Mathf.Max(0.001f, duration); InitWithDuration(duration); m_split = m_action1.Duration / m_duration; }