本文整理汇总了C#中Transition.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Transition.ToString方法的具体用法?C# Transition.ToString怎么用?C# Transition.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transition
的用法示例。
在下文中一共展示了Transition.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTransition
// Add Transition
public void AddTransition(Transition trans, StateID id)
{
//check if transition exist
if(trans == Transition.NULL)
{
Debug.LogError("Trying to add a null transition");
return;
}
if(id == StateID.NULL)
{
Debug.LogError("Trying to add a null state");
return;
}
if(trans == Transition.E_NOHP)
{
Debug.Log("trans: " + trans.ToString() + " StateID: " + id.ToString());
}
// check if current map already contains key
if(map.ContainsKey(trans))
{
Debug.LogError(trans.ToString() + " transition Exist, unable to have duplicate transitions for State: " + id.ToString());
return;
}
map.Add(trans, id);
Debug.Log("Sucessfully added: " + trans.ToString() + " id extract: " + map[trans] + " Current StateID: " + STATE_ID.ToString());
}
示例2: AddTransition
public void AddTransition(Transition trans, StateID id)
{
//first step of the fsm
//check the args and see if they are invalid
if (trans == Transition.NullTransition) {
Debug.LogError("FSM had a pretty bad error. Null transition is not allowed for a real tranisition. \n You have a shit ton of work david");
return;
}
if (id == StateID.NullStateID) {
Debug.LogError("FSM had a pretty bad error. Null STATE id is not allowed for a real ID");
return;
}
// deterministic FSM
// check if current transition was already inside the map
if (map.ContainsKey(trans)) {
// fuck, if this hits ive hit a transition that already has a transition
// Enum enumerations = RuntimeTypeHandle.ReferenceEquals(StateID);
Debug.LogError("FSM had a pretty bad error" + stateID.ToString() + " Already has a transition"
+trans.ToString() + " Impossible to assign to another state");
return;
}
map.Add(trans, id);
}
示例3: AddTransition
public void AddTransition(Transition trans, StateID id)
{
// Check if anyone of the args is invalid
if (trans == Transition.NullTransition)
{
Debug.LogError("FSMState ERROR: NullTransition is not allowed for a real transition");
return;
}
if (id == StateID.NullStateID)
{
Debug.LogError("FSMState ERROR: NullStateID is not allowed for a real ID");
return;
}
// Since this is a Deterministic FSM,
// check if the current transition was already inside the map
if (map.ContainsKey(trans))
{
Debug.LogError("FSMState ERROR: State " + stateID.ToString() + " already has transition " + trans.ToString() +
"Impossible to assign to another state");
return;
}
map.Add(trans, id);
}
示例4: DeleteTransition
public void DeleteTransition(Transition trans)
{
if(trans==Transition.NullTransition)
{
Debug.LogError("FSM ERROR:map中部可能存在空转换");
return;
}
if(map.ContainsKey(trans))
{
map.Remove(trans);
return;
}
Debug.LogError("FSM ERROR:map中不存在"+trans.ToString());
}
示例5: DeleteTransition
public void DeleteTransition(Transition trans)
{
if(trans == Transition.NullTransition)
{
Debug.LogError("FSMState Error: NullTransition is not allowed");
return;
}
if(map.ContainsKey(trans))
{
map.Remove(trans);
return;
}
Debug.LogError("FSMState Error: Transition " + trans.ToString() + " passed to " + stateID.ToString() + " was not on the state transition list");
}
示例6: DeleteTransition
public void DeleteTransition(Transition transition)
{
if (transition == Transition.NullTransition)
{
Debug.LogError("NPCState DeleteTransition(): NullTransition is not allowed");
return;
}
if (transitionMap.ContainsKey(transition))
{
transitionMap.Remove(transition);
return;
}
Debug.LogError("NPCState DeleteTransition(): " + transition.ToString() + " is not on " +
stateID.ToString() + " transition list");
}
示例7: DeleteTransition
/// <summary>
/// This method deletes a pair transition-state from this state's map.
/// If the transition was not inside the state's map, an ERROR message is printed.
/// </summary>
public void DeleteTransition(Transition trans)
{
// Check for NullTransition
if (trans == Transition.NullTransition)
{
Debug.LogError("FSMState ERROR: NullTransition is not allowed");
return;
}
// Check if the pair is inside the map before deleting
if (map.ContainsKey(trans))
{
map.Remove(trans);
return;
}
Debug.LogError("FSMState ERROR: Transition " + trans.ToString() + " passed to " + stateID.ToString() +
" was not on the state's transition list");
}
示例8: AddTransition
public void AddTransition(Transition trans,StateID id)
{
if(trans==Transition.NullTransition)
{
Debug.LogError("FSM ERROR:map中转换不能为NullTransition");
return;
}
if(id==StateID.NullStateID)
{
Debug.LogError("FSM ERROR:空状态标签不能添加到map中,而且一个实际的状态标签不能为空");
return;
}
if(map.ContainsKey(trans))
{
Debug.LogError(id.ToString()+"FSM ERROR:已经存在"+trans.ToString()+"的转换了");
return;
}
map.Add(trans,id);
}
示例9: EventType
public EventType(string activity, string resource, DateTime timestamp, Transition transition)
{
// <event>
// <string key="concept:name" value="Start"/>
// <string key="lifecycle:transition" value="complete"/>
// <string key="org:resource" value="Start"/>
// <date key="time:timestamp" value="2010-03-09T08:05:00.000+01:00"/>
// <string key="Activity" value="Start"/>
// <string key="Resource" value="Start"/>
// </event>
this.Items = new AttributableType[]
{
new AttributeStringType() { key = "concept:name", value = activity },
new AttributeStringType() { key = "lifecycle:transition", value = transition.ToString().ToLower() },
new AttributeStringType() { key = "org:resource", value = resource },
new AttributeDateType() { key = "time:timestamp", value = timestamp },
new AttributeStringType() { key = "Activity", value = activity },
new AttributeStringType() { key = "Resource", value = resource }
};
}
示例10: AddTransition
public void AddTransition(Transition trans, StateID id)
{
if(trans == Transition.NullTransition)
{
Debug.LogError("FSMState Error: NullTransition is not allowed for a real transition");
return;
}
if(id == StateID.NullStateID)
{
Debug.LogError("FSMState Error: NullStateID is not allowed for a real ID");
return;
}
if(map.ContainsKey(trans))
{
Debug.LogError("FSMState Error: State " + stateID.ToString() + " already has transition " + trans.ToString() + ". Impossible to assign to another state");
return;
}
map.Add(trans, id);
}
示例11: AddTransition
public void AddTransition(Transition transition, StateID id)
{
if (transition == Transition.NullTransition)
{
Debug.LogError("NPCState AddTransition(): NullTransition is not allowed for a real transition");
return;
}
if (id == StateID.NullStateID)
{
Debug.LogError("NPCState AddTransition(): NullStateID is not allowed for a real ID");
return;
}
if (transitionMap.ContainsKey(transition))
{
Debug.LogError("NPCState AddTransition(): " + stateID.ToString() + " already has transition " +
transition.ToString());
return;
}
transitionMap.Add(transition, id);
}
示例12: GetTransitionFunc
TranistionFunc GetTransitionFunc(Transition transition)
{
switch (transition)
{
case Transition.ShiftLeft: return ShiftLeft;
case Transition.ShiftRight: return ShiftRight;
case Transition.MoveLeft: return MoveLeft;
case Transition.MoveRight: return MoveRight;
case Transition.Fade: return Fade;
default: throw new NotSupportedException(transition.ToString());
}
}
示例13: PerformTransition
/// <summary>
/// This method tries to change the state the FSM is in based on
/// the current state and the transition passed. If current state
/// doesn't have a target state for the transition passed,
/// an ERROR message is printed.
/// </summary>
public void PerformTransition(Transition trans)
{
// Check for NullTransition before changing the current state
if (trans == Transition.NullTransition)
{
Debug.LogError("FSM ERROR: NullTransition is not allowed for a real transition");
return;
}
// Check if the currentState has the transition passed as argument
StateID id = currentState.GetOutputState(trans);
if (id == StateID.NullStateID)
{
Debug.LogError("FSM ERROR: State " + currentStateID.ToString() + " does not have a target state " +
" for transition " + trans.ToString());
return;
}
// Update the currentStateID and currentState
currentStateID = id;
foreach (FSMState state in states)
{
if (state.ID == currentStateID)
{
// Do the post processing of the state before setting the new one
currentState.DoBeforeLeaving();
currentState = state;
// Reset the state to its desired condition before it can reason or act
currentState.DoBeforeEntering();
break;
}
}
} // PerformTransition()
示例14: PerformTransition
public void PerformTransition(Transition trans)
{
if(trans==Transition.NullTransition)
{
Debug.LogError("FSM ERROR:空转换是不能运用在实际转换中的");
return;
}
StateID id = CurrentState.GetOutputState (trans);
if(id==StateID.NullStateID)
{
Debug.LogError("FSM ERROR:当前状态"+CurrentStateID.ToString()+"不存在"+trans.ToString()
+"的转换");
return;
}
CurrentStateID = id;
foreach(FSMState state in states)
{
if(state.ID==CurrentStateID)
{
CurrentState.DoBeforeLeaving();
CurrentState=state;
CurrentState.DoBeforeEntering();
break;
}
}
}
示例15: PerformTransition
/// <summary>
/// Tries to change the state of the FSM based on the current state
/// and the given transition.
/// If the current state does not have a target state for the passed transition,
/// no transition will be performed.
/// </summary>
/// <param name="transition">Transition</param>
public void PerformTransition(Transition transition)
{
// StateID of the desired transition.
StateID id = currentState.GetOutputState(transition);
if (transition == Transition.NullTransition)
Debug.LogError("FSMState: NullTransition is not allowed.");
else if (id == StateID.NullStateID)
Debug.LogError("FSMState: State " + currentStateID.ToString() + " does not have a target state for transition " + transition.ToString());
else
{
// Change current state
currentStateID = id;
foreach (FSMState state in states)
{
if (state.ID == currentStateID)
{
// Call processing before leaving.
currentState.DoBeforeLeaving();
//Change current state.
currentState = state;
//Call proceccing after entering.
currentState.DoBeforeEntering();
break;
}
}
}
}