当前位置: 首页>>代码示例>>C#>>正文


C# Transition.populate方法代码示例

本文整理汇总了C#中Transition.populate方法的典型用法代码示例。如果您正苦于以下问题:C# Transition.populate方法的具体用法?C# Transition.populate怎么用?C# Transition.populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transition的用法示例。


在下文中一共展示了Transition.populate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: isAGoalState

	/// <summary>
	/// Returns true if the current State is a Goal State.
	/// </summary>
	public override bool isAGoalState (ref DefaultState currentStates, ref DefaultState idealGoalState)
	{
		bool finished = true;
		List<Transition> endTransitions = manager.endTransitions;
		foreach (Transition trans in endTransitions)
		{
			Transition tran = new Transition(trans.eventSig, trans.parameterIDs);
			finished = tran.populate(currentStates.worldstate);
			if(!finished)
				return false;
		}

		long cS, gS, cSR, gSR;
		int nrRelevantPrototypes = relevanceMasks.Length;

		for(int i = 0; i<nrRelevantPrototypes;i++)
		{
            if (relevanceMasks[i].stateRelevant)
			{
				cS = (currentStates.worldstate.GetPrototypeById(relevanceMasks[i].id)).State.GetStateBits() & relevanceMasks[i].stateMask;
				gS = (idealGoalState.worldstate.GetPrototypeById(relevanceMasks[i].id)).State.GetStateBits() & relevanceMasks[i].stateMask;
            	finished = finished && (countSetBits(cS ^ gS)==0);
				if(!finished)
					return false;
            }
			if(relevanceMasks[i].relationsRelevant)
			{
				for(uint j=0; j<noStatesInGS; j++)
				{
					cSR = currentStates.worldstate.GetPrototypeById(relevanceMasks[i].id).State.GetRelationBits(j) & relevanceMasks[i].GetRelationBits(j);
					gSR = idealGoalState.worldstate.GetPrototypeById(relevanceMasks[i].id).State.GetRelationBits(j)& relevanceMasks[i].GetRelationBits(j);
					finished = finished && (countSetBits(cSR ^ gSR)==0);
					if(!finished)
						return false;
				}
			}
		}
		return finished;
	}
开发者ID:fgeraci,项目名称:CS195-Core,代码行数:42,代码来源:EventPlanner.cs

示例2: SimulateUpTo

	/// <summary>
	/// Simulate the state of the StateSpaceManager up to a certain Beat (specified by level)
	/// </summary>
	public void SimulateUpTo(StateSpaceManager stateSpaceManager, int startLevel, StoryArc story)
	{
		stateSpaceManager.resetGlobalState ();
		for(int i=0; i< startLevel; i++)
		{	
			foreach(StoryEvent ev in story.Beats[i].Events)
			{
				Rules.ClearCache();
				Transition implicitPopulated = new Transition(ev);
				implicitPopulated.populate(stateSpaceManager.globalState.worldstate);
				stateSpaceManager.changeStateToPostconditionsOf(implicitPopulated);
			}
		}
	}
开发者ID:fgeraci,项目名称:CS195-Core,代码行数:17,代码来源:EventPlanner.cs


注:本文中的Transition.populate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。