本文整理汇总了C#中WorldState.SetSymbol方法的典型用法代码示例。如果您正苦于以下问题:C# WorldState.SetSymbol方法的具体用法?C# WorldState.SetSymbol怎么用?C# WorldState.SetSymbol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldState
的用法示例。
在下文中一共展示了WorldState.SetSymbol方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Teste
public void Teste()
{
AstarPlanner Planner = new AstarPlanner();
Planner.Actions.Add(new KillAction());
Planner.Actions.Add(new BeProtectedAction());
Planner.Actions.Add(new BeArmedAction());
Planner.Actions.Add(new GoToAction("lugar0", "lugar1",2));
Planner.Actions.Add(new GoToAction("lugar1", "lugar2", 2));
Planner.Actions.Add(new GoToAction("lugar2", "lugar1", 2));
Planner.Actions.Add(new GoToAction("lugar1", "lugar0", 2));
WorldState TestWorldState = new WorldState();
TestWorldState.SetSymbol(new WorldSymbol("Armed", false));
TestWorldState.SetSymbol(new WorldSymbol("Place", "lugar0"));
TestWorldState.SetSymbol(new WorldSymbol("Protected", false));
TestWorldState.SetSymbol(new WorldSymbol("EnemyKilled", false));
PlanSet PlanSet = Planner.CreatePlan(
TestWorldState,
new TesteGoal()
);
System.Diagnostics.Debug.Assert(PlanSet != null);
}
示例2: ApplyEffects
public override void ApplyEffects(WorldState WorldState)
{
///add one unit
WorldSymbol WorldSymbol = WorldState.GetSymbol(unitName);
if (WorldSymbol == null)
WorldSymbol = new WorldSymbol(unitName, 0);
WorldSymbol.SetSymbol<int>(WorldSymbol.GetSymbol<int>() + 1);
WorldState.SetSymbol(WorldSymbol);
////remove the resources
foreach (var item in resourcesNeeded)
{
WorldSymbol WorldSymbol2 = WorldState.GetSymbol(item.Key);
WorldSymbol2.SetSymbol<int>(WorldSymbol2.GetSymbol<int>() - item.Value);
WorldState.SetSymbol(WorldSymbol2);
}
}