public void Goto(params StateLink[] serires) { if (serires.Length <= 0) { return; } if (!ignoreSeriesRunningCheck && StateLinkSeries.Count > 0) { Debug.LogWarning(string.Format("{0}.StateMachine >> New StateLinkSerires(firstStateName'{1}') is accepted," + " but Current StateLinkSerires(nextStateName'{2}') is already running. This serires will be stoped and clear.", gameObject.name, serires[0].stateName, StateLinkSeries.First.Value.stateName)); StateLinkSeries.Clear(); } foreach (var stateLink in serires) { StateLinkSeries.AddLast(stateLink); } ignoreSeriesRunningCheck = true; { Goto(StateLinkSeries.First.Value.stateName, StateLinkSeries.First.Value.timeLength, StateLinkSeries.First.Value.delayTime); } ignoreSeriesRunningCheck = false; StateLinkSeries.RemoveFirst(); }
public void Goto(string stateName, float timeLength = float.PositiveInfinity, float delayTime = 0.0f) { if (!stateMap.ContainsKey(stateName)) { Debug.LogWarning(string.Format("{0}.StateMachine >> stateName '{1}' is not found.", gameObject.name, stateName)); return; } if (!ignoreSeriesRunningCheck && StateLinkSeries.Count > 0) { Debug.LogWarning(string.Format("{0}.StateMachine >> stateName '{1}' is accepted," + " but StateLinkSerires(nextStateName'{2}') is already running. This serires will be stoped and clear.", gameObject.name, stateName, StateLinkSeries.First.Value.stateName)); StateLinkSeries.Clear(); } Goto(stateMap[stateName], timeLength, delayTime); }