本文整理汇总了C#中Action.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# Action.CopyTo方法的具体用法?C# Action.CopyTo怎么用?C# Action.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action.CopyTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChooseAction
public Action ChooseAction()
{
var processedActions = 0;
int currentDepth = 0;
var startTime = Time.realtimeSinceStartup;
Action[] actions = new Action[MAX_DEPTH];
while(currentDepth >= 0){
if (processedActions > MAX_PROCESSED_ACTIONS)
{
InProgress = true;
return null;
}
float currentValue = Models[currentDepth].CalculateDiscontentment(Goals);
if(currentDepth >= MAX_DEPTH){
if(currentValue < BestDiscontentmentValue){
BestDiscontentmentValue = currentValue;
BestAction = actions[0];
BestDiscontentmentValue = BestDiscontentmentValue;
actions.CopyTo(BestActionSequence,0);
TotalProcessingTime = Time.realtimeSinceStartup - startTime;
}
processedActions++;
TotalActionCombinationsProcessed++;
currentDepth -= 1;
continue;
}
Action nextAction = Models[currentDepth].GetNextAction();
if (nextAction != null){
Models[currentDepth+1] = Models[currentDepth].GenerateChildWorldModel();
nextAction.ApplyActionEffects(Models[currentDepth+1]);
actions[currentDepth] = nextAction;
currentDepth += 1;
}
else
currentDepth -= 1;
}
InProgress = false;
return BestAction;
}
示例2: ChooseAction
public Action ChooseAction()
{
var processedActions = 0;
var startTime = Time.realtimeSinceStartup;
Action[] actions = new Action[MAX_DEPTH];
while (this.CurrentDepth >= 0)
{
if(processedActions > this.ActionCombinationsProcessedPerFrame)
{
this.InProgress = true;
return null;
}
float currentValue = this.Models[this.CurrentDepth].CalculateDiscontentment(this.Goals);
if (this.CurrentDepth >= MAX_DEPTH)
{
if (currentValue < this.BestDiscontentmentValue)
{
this.BestDiscontentmentValue = currentValue;
this.BestAction = actions[0];
actions.CopyTo(this.BestActionSequence,0);
this.TotalActionCombinationsProcessed += processedActions;
this.TotalProcessingTime += Time.realtimeSinceStartup - startTime;
}
this.CurrentDepth -= 1;
continue;
}
Action nextAction = this.Models[this.CurrentDepth].GetNextAction();
processedActions++;
if (nextAction != null)
{
this.Models[this.CurrentDepth + 1] = this.Models[this.CurrentDepth].GenerateChildWorldModel();
nextAction.ApplyActionEffects(this.Models[this.CurrentDepth + 1]);
actions[CurrentDepth] = nextAction;
this.CurrentDepth += 1;
}
else
this.CurrentDepth -= 1;
}
this.InProgress = false;
return this.BestAction;
}