本文整理汇总了C#中BuildingBlock类的典型用法代码示例。如果您正苦于以下问题:C#BuildingBlock类的具体用法?C#BuildingBlock怎么用?C#BuildingBlock使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:Person
internalPerson(intid,doublemovementSpeed,BuildingBlockposition)
{
if(id<=0)
{/*Negativeorzero-valuedidmeansthisisatotallynewperson*/
intnewID;
do
{
newID=_idCounter++;
}while(IdsInUse.Contains(newID));
ID=newID;
}
else
{
/*non-zeroed,positivevaluemeansthisisanexistingperson*/
if(IdsInUse.Contains(id))
thrownewPersonException($"AuserwithID{id}alreadyexists!");
ID=id;
}
PersonInteractionStats=newDataSimulationStatistics();
//3-8kmt
MovementSpeed=movementSpeed<3?3+Rand.NextDouble()*5:movementSpeed;//Lessthan5meansthatitwasnotcreated.
MovementSpeed=3+Rand.NextDouble()*5;
MovementSpeedInMetersPerSecond=(MovementSpeed*1000)/60/60;
Position=position;
//Iftheirpositionisint16.maxvalue,ifthepriorityisnotassigned==Thatthereisnopath,
//Theywillnotbetouchedinthesimulation,butwillbeaddedtothecounterinCP_SimulationStats
if(position.Priority==Int16.MaxValue)
{
NoPathAvailable=true;
}
OriginalPosition=position;
}
原文链接:
http://www.jxszl.com/biancheng/C/556600.html